Is there a way to prevent Castle Windsor from automatically injecting dependencies into properties (besides the [DoNotWire] attribute)?
Asked
Active
Viewed 2,767 times
2 Answers
2
Duplicate: Windsor Container: How to specify a public property should not be filled by the container?
See also:

Community
- 1
- 1

Mauricio Scheffer
- 98,863
- 23
- 192
- 275
1
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)

Jan Palas
- 1,865
- 1
- 23
- 35