ipjohnson / Grace

Grace is a feature rich dependency injection container library
MIT License
337 stars 33 forks source link

ImportMembers misses members on base classes #118

Closed RandomEngy closed 7 years ago

RandomEngy commented 7 years ago

When I've marked some members with the [Import] attribute and call ImportMembers(MembersThat.HaveAttribute<ImportAttribute>()) , it misses marked members on the base class.

It would be nice if it found members on the base class, and also had a way to automatically import marked members for all types, without needing to use ImportMembers on every registration.

ipjohnson commented 7 years ago

@RandomEngy I'll tighten up the logic this weekend to make sure base properties are injectable

currently there is a c# extension for registration block ImportMembers that is container wide but it requires the type of the property.

In theory you should be able to do

container.Configure(c => c.ImportMembers<object>(MembersThat.HaveAttribute<ImportAttribute>()));

but there again it uses the same logic so it more than likely is going to miss the base properties.

Sorry about this I'll make sure it's included in this weekends release.