Is it possible, or where should I look for an extension hook to define a conditional import in MEF?
Sort of the inverse of an optional import (AllowDefault=true). What I have is a property import and I don’t want to blow the current value away if it has already been set.
Cheers
MEF doesn’t have support for something like this. You could write a property that ignored any sets after the first non-null one:
I’m not sure what the use case for this is, so I’m not sure if this will help you. MEF doesn’t set imports more than once except for recomposable imports during recomposition.