More docs. I’m working on it.
In the beginning, StructureMap configuration began and ended with a single file named "StructureMap.config" in the application base folder that contained StructureMap Xml configuration (in short, wherever your App.config file would go). Today, the default behavior is that StructureMap will automatically read in configuration data from the StructureMap.config if it is found when either ObjectFactory.Initialize() is called, or the first time that a service is requested from ObjectFactory. You can technically use only the StructureMap.config file and completely forgo the the usage of any programmatic bootstrapping.
You can override the default behavior for the StructureMap.config file. If you want to make the StructureMap.config file mandatory, you can do this:
ObjectFactory.Initialize(x =>
{
// We put the properties for an NHibernate ISession
// in the StructureMap.config file, so this file
// must be there for our application to
// function correctly
x.UseDefaultStructureMapConfigFile = true;
});
At other times you might want to force ObjectFactory to ignore the StructureMap.config file even if it does exist.
ObjectFactory.Initialize(x =>
{
x.IgnoreStructureMapConfig = true;
});
Posted
Sat, Oct 25 2008 8:42 PM
by
Jeremy D. Miller