Potentially Misconfigured Components using TypedFactory
I'm learning how to use Windsor TypedFactory: that feature it's just awesome! I made it work for my need, but I have a concern about having 1 Potentially Misconfigured Components "Castle.TypedFactory.DelegateProxyFactory" IProxyFactoryExtension / DelegateProxyFactory...
that's my container and everything is working... still just concern about that 开发者_Go百科waring from built container
container = new WindsorContainer();
container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));
container.AddFacility<TypedFactoryFacility>();
container.Register(Component.For<ITypedFactoryComponentSelector>().ImplementedBy<CustomTypedFactoryComponentSelector>());
container.Register
(
Component.For<Contracts.IConverter>().ImplementedBy<Components.Converter1>().Named("Converter1").LifeStyle.Singleton,
Component.For<Contracts.IConverter>().ImplementedBy<Components.Converter2>().Named("Converter2").LifeStyle.Singleton,
Component.For<Contracts.IConverterFactory>().AsFactory(c => c.SelectedWith(new CustomTypedFactoryComponentSelector())),
Component.For<ConverterHelper>().LifeStyle.Transient
);
Adding
container.Register(Component.For<ITypedFactoryComponentSelector>().ImplementedBy<CustomTypedFactoryComponentSelector>());
I solved an additional "Potentially Misconfigured Components" "Castle.TypedFactory.Interceptor" TypedFactoryInterceptor
how can i fix remaining one?
crixo - there's a reason why that's called Potentially Misconfigured component. Notice the emphasis.
The reason being, in this case that the ''missing'' dependency here is provided dynamically to the DelegateProxyFactory
and Windsor can not verify that statically.
So that means that if you were to use that component directly you might end up not being able to resolve it unless you'd provide the missing dependency on the fly. However the facility makes sure it always does that, so the component is always resolved properly if used through the facility.
In other words - you can safely ignore that warning.
PS,
since you're providing the CustomTypedFactoryComponentSelector
inline you don't need to register it. Future version of Windsor will be able to figure out dependencies like that and provide them for you. Right now, just rest assured it will work.
In other words - you can safely ignore that warning.
精彩评论