dadhi / DryIoc

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

Allow filling of properties on an existing instance #602

Closed Maxwell175 closed 11 months ago

Maxwell175 commented 11 months 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);