{"id":4752,"date":"2014-03-30T15:06:20","date_gmt":"2014-03-30T15:06:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-use-mef-to-init-a-group-of-classes-collection-of-common-programming-errors\/"},"modified":"2014-03-30T15:06:20","modified_gmt":"2014-03-30T15:06:20","slug":"how-to-use-mef-to-init-a-group-of-classes-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-use-mef-to-init-a-group-of-classes-collection-of-common-programming-errors\/","title":{"rendered":"How to use MEF to init a group of classes?-Collection of common programming errors"},"content":{"rendered":"<p>I use prism\/mvvm\/mef for my app, and loading all Views marked with ViewExport(Region) does work nicely (I&#8217;m using the StockTraderRI AutoPopulateExportedViewsBehaviour).<\/p>\n<p>Now I&#8217;d like to use this runtime lookup capability to initialise some other background classes.<\/p>\n<p>Say I got an interface<\/p>\n<pre><code>public interface ITable\n{\n}\n<\/code><\/pre>\n<p>And I got a lot of classes deriving from this interface.<\/p>\n<p>Is there a way to mark those derived classes somehow and get MEF to create them on runtime and add them into some kind of list or container?<\/p>\n<p>Like into a region which is not shown anywhere, I&#8217;d expect? How would I achieve this in MEF?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use prism\/mvvm\/mef for my app, and loading all Views marked with ViewExport(Region) does work nicely (I&#8217;m using the StockTraderRI AutoPopulateExportedViewsBehaviour). Now I&#8217;d like to use this runtime lookup capability to initialise some other background classes. Say I got an interface public interface ITable { } And I got a lot of classes deriving from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4752","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4752"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4752\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}