![](/img/trans.png)
[英]How can I implement Ninject .InSingletonScope() when using Unity IoC
[英]How would I do the following NInject registration with Unity IoC?
我希望能够统一进行以下类型注册,有人知道吗?
Bind<ILogger>().To<AssemblyEditorLogger>()
.WithConstructorArgument("currentClassName",
x => x.Request.ParentContext != null ?
x.Request.ParentContext.Request.Service.FullName : typeof (BootStrapper).FullName);
基本上在Unity中,我如何访问要为其创建实例的类的类型-我正在使用构造函数注入。
与这个问题有关 。
您可以使用对LogManager.GetLogger()
相同的方式来访问类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.