When I
container.RegisterType<IInterface, MyClass>();
everything works, and all dependent properties are annotated with:
[Dependency]
resolved through the container.
But now I have an int property, which I would also like to resolve through the container. It is not passed in the constructor, but as public property. So I tried this:
container.RegisterType<IInterface, MyClass>(
new InjectionProperty("PropertyName", 1)
);
Now this property is being introduced, but all other properties annotated with [Dependency] are null and not allowed. If I use InjectionProperty for one property, now I need to explicitly declare all other properties that have the [Dependency] attribute? Or is there a better way to do this?
Thanks.
source
share