开发者

StructureMap configuration using app.config

开发者 https://www.devze.com 2023-01-24 05:18 出处:网络
I need to move my StructureMap configuration from a configuration class to my application\'s 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

精彩评论

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