我有一个类需要Type
作为构造函数参数。我如何在Windsor容器中注册?Castle Windsor - 传递类型作为构造函数参数
public Class NLogLogger : ILogger
{
private NLog.Logger _logger;
public NLogLogger(Type type)
{
_logger = NLog.LogManager.GetLogger(type.FullName);
}
...
}
我想这种方式进行注册:
container.Register(Component.For(typeof(ILogger))
.ImplementedBy(typeof(NLogLogger))
.LifestyleTransient()
.DependsOn(new Hashtable
{
{"type", ???}
}));
我需要填写???
。我无法弄清楚如何在那里传递呼叫班的Type
。
什么是调用类的类型? 'container.Resolve()'的类的类型? –
2012-03-21 13:30:12