dependency injection - How to use MEF to init a group of classes? -
i use prism/mvvm/mef app, , loading views marked viewexport(region) work nicely (i'm using stocktraderri autopopulateexportedviewsbehaviour).
now i'd use runtime lookup capability initialise other background classes.
say got interface
public interface itable { }
and got lot of classes deriving interface.
is there way mark derived classes somehow , mef create them on runtime , add them kind of list or container?
like region not shown anywhere, i'd expect? how achieve in mef?
sure there is! mark classes inheriting interface export attribute , in class create property of generic type observablecollection attribute [importmany]. should trick.
Comments
Post a Comment