Closed RandomEngy closed 6 years ago
I see why that didn't work. The ImportMembers isn't taking into account the ImportAttribute it's only being used for filtering purposes (i.e the ImportAttribute isn't being inspected).
This code is still failing for me in 6.3.0.
Grace.DependencyInjection.Exceptions.LocateException: 'Could not locate Type TestConsoleApp.IDep
1 Importing TestConsoleApp.ITest
2 Importing TestConsoleApp.IDep for property MyDep1
Hmm now I'm a little flummexed because I added the following unit test for this use case.
Maybe it's a matter of ImportMembers()
vs ImportMembers<T>()
Just to check the ImportAttribute we are talking about is the one found in Grace not the ImportAttribute from MEF?
Oh my bad, I was doing ImportMember<T>
instead of ImportMembers<T>
. It's working now.
Just to come full circle on why ImportMember<T>
didn't work, I marked the old method as Obsolete because the naming convention is different than the one in Export<T>
and left the old functionality the exact same (not processing attributes as I didn't want to introduce new behavior and break older code).
Dependency properties don't seem to work with keys.
...
Exception is: