开发者

how to pass list in the constructor using Windsor castle

I have got IController which implements 2 ControllerA, ControllerB

say I have a class:

public class MyComponent
{
   public MyComponent(List<IController> constrollers)
   {
      _constrollers = constrollers;
   }
}

in order to instantiate this class there is a way in windsor castle with using XML

<parameters>
   <constrollers>
      <list>
         <item>controllerA</item>
         <item>controllerB</item>
      </constrollers>
 开发者_如何学运维  </info>
</parameters>

but how can I achieve it programatically, using Fluent ?


container.Register(Component.For<MyComponent>()
 .ServiceOverrides(new { controllers = new[] { "controllerA", "controllerB" } }));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜