Allow filling of properties on an existing instance #603
Answered
by
dadhi
Maxwell175
asked this question in
Q&A
-
Hello, I would like to inject services only for properties that have a specific attribute (I am using the MEF extensions for this). I would like to be able to inject the properties of an existing instance of a class that was created using some other mechanism than .Resolve(). class A
{
[Import]
public MyService Svc { get; set; }
}
var A = new A();
container.<some function>(A);
Assert.NotNull(A.Svc); |
Beta Was this translation helpful? Give feedback.
Answered by
dadhi
Oct 22, 2023
Replies: 1 comment
-
@Maxwell175 You may use container.InjectPropertiesAndFields(a) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Maxwell175
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Maxwell175 You may use
InjectPropertiesAndFields
method: