Reputation: 1580
Is there a way to prevent Castle Windsor from automatically injecting dependencies into properties (besides the [DoNotWire] attribute)?
Upvotes: 2
Views: 2842
Reputation: 1895
If you want to turn off property injection globally, you can use this code:
// We don't want to inject properties, only ctors
var propInjector = Kernel.ComponentModelBuilder
.Contributors
.OfType<PropertiesDependenciesModelInspector>()
.Single();
Kernel.ComponentModelBuilder.RemoveContributor(propInjector);
(Code sample taken from Castle Windsor docs - refer for further details)
Upvotes: 1
Reputation: 99730
Duplicate: Windsor Container: How to specify a public property should not be filled by the container?
See also:
Upvotes: 2