I need to move my StructureMap configuration from a configuration class to my application's app.config.
Anyone know if the following code has an开发者_Python百科 XML configuration equivalent?
For(typeof(ILogger<>)).Use(typeof(Log4NetLogger<>));
The StructureMap documentation says you can use the DefaultInstance Element
eg:
<DefaultInstance
PluginType="StructureMap.Testing.Widget.IWidget,StructureMap.Testing.Widget"
PluggedType="StructureMap.Testing.Widget.ColorWidget,StructureMap.Testing.Widget"
Scope="Singleton" />
In the sample node above, the parts are:
- PluginType -- Assembly qualified name of the PluginType (the "T" in ObjectFactory.GetInstance() )
- PluggedType -- Assembly qualified name of the actual, concrete PluggedType
- Scope -- Optionally defines the scope/lifecycle for this PluginType
http://structuremap.net/structuremap/XmlReference.htm#section7
精彩评论