dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
1.03k stars 122 forks source link

Allow filling of properties on an existing instance #602

Closed Maxwell175 closed 1 year ago

Maxwell175 commented 1 year ago

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);