Is it possible to access export metadata in MEF without storing
IList<Lazy<T,TM>> parts,
but simply
IList<T> parts
Is it possible to access export metadata in MEF without storing IList<Lazy<T,TM>> parts ,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, you cannot get the metadata after the fact. You must import it along with the parts themselves.
Think of the import as a contract specifying the needs of your component. If it needs access to the metadata of some dependency, then you shouldn’t hide that.
See also Nicholas Blumhardt’s post about The Relationship Zoo, where this kind of relationship between components is described as A needs to know X about B before using it. The point is that this metadata is an aspect of the relationship between components, not something that should be handled separately somehow.