Specifying instance for registration of a component with Castle Windsor

后端 未结 2 654
我在风中等你
我在风中等你 2021-02-18 23:03

I have what is probably a simple question here about Castle Windsor, which I haven\'t been using for very long. I\'m trying to register a service with a specific instance that w

2条回答
  •  走了就别回头了
    2021-02-18 23:14

    Try using the AddComponentInstance method on the container's Kernel object. I think this is what you need.


    Please note: This technique is now deprecated. Use container.Register(Component.For().Instance(myT)); instead (thanks to eouw0o83hf)

提交回复
热议问题