Why use MEF metadata instead of extending the interface to include metadata?

So why use the ExportMetadata attribute, why not just extend the interface?

+4
source share
2 answers

if you import Lazy <> stuff through MEF, you can view the metadata without instantiating your object.

+6
source
Good question. I think an interface extension is the right thing to do when you have the option. He communicates intentions much better .

However, we may require more granular control over interfaces that we do not own . In these cases, we can use ExportMetadata as a replacement.

In my opinion, you should use ExportMetadata if there is no other option for you .

+4
source

All Articles