开发者

StructureMap configuration using app.config

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:

  1. PluginType -- Assembly qualified name of the PluginType (the "T" in ObjectFactory.GetInstance() )
  2. PluggedType -- Assembly qualified name of the actual, concrete PluggedType
  3. Scope -- Optionally defines the scope/lifecycle for this PluginType

http://structuremap.net/structuremap/XmlReference.htm#section7

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜