2011-09-27 86 views
2

我收到“潜在的生活方式不匹配”​​拦截单实例

组件“MyComponent的”生活方式辛格尔顿取决于 “Castle.TypedFactory.Interceptor”随着生活方式的瞬态

有什么问题使用拦截器对多个singletone实例?

,Component.For<ApiInterceptor>() 

, AllTypes.FromAssemblyContaining<MyServiceContract>() 
    .Where(Component.IsInSameNamespaceAs<MyServiceContract>()) 
    .Configure(c => c.Interceptors(typeof(ApiInterceptor))) 
    .Configure(c => c.LifeStyle.Singleton) 

回答

2

这可能是好的。有一个原因为什么这种诊断称为潜在生活方式不匹配。

+1

我假设消息的原因是由TypedFactory Facilty设置为Transient设置的“Castle.TypedFactory.Interceptor”生活方式。我的猜测是,生活方式已被选中以适应所有情况。我对吗? – Crixo

+1

是的,拦截器是暂时的,给它最大的灵活性。 –