开发者

How to wireup a class that doesn't have an interface

开发者 https://www.devze.com 2023-04-11 15:44 出处:网络
I have a class that just has public properties of services that are already wired up in Windsor. How can I 开发者_JS百科register this class?

I have a class that just has public properties of services that are already wired up in Windsor.

How can I 开发者_JS百科register this class?

I only know this pattern:

 container.Register(Component.For(typeof (IRepository<>))
                    .ImplementedBy(typeof (Repository<>)));

But this class doesn't have an interface, it is the implementation. I am only looking to set this up so the properties are preconfigured when I instantiate it.


container.Register(Component.For(typeof(Repository<>)));

or for closed types:

container.Register(Component.For<MyConcreteType>());
0

精彩评论

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

关注公众号