开发者

Return a component instance by key (using Ninject Container)

开发者 https://www.devze.com 2023-02-28 21:06 出处:网络
Is it possible to return a component ins开发者_如何转开发tance by key using Ninject? The equivalent to Castle Windsor is for ex.:

Is it possible to return a component ins开发者_如何转开发tance by key using Ninject?

The equivalent to Castle Windsor is for ex.:

container.Register(Component.For< ConcreteA >().Named("KeyForConcreteA"));


Bind<ConcreteA>().ToSelf().Named("KeyForConcreteA")
var a = kernel.Get<ConcreteA>("KeyForConcreteA");
0

精彩评论

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