Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What are the rules that will decide whether you use class A or B? You can write your own resolver for MEF exports.</p> <p>This blog post <a href="http://randomactsofcoding.blogspot.com/2010/01/configurable-type-catalog-for-mef.html" rel="nofollow">http://randomactsofcoding.blogspot.com/2010/01/configurable-type-catalog-for-mef.html</a> mentions one approach and there are a few other ones that you can find if you search for "mef custom export provider" or "mef custom catalog"</p> <p><strong>EDIT:</strong> Your scenario reminds me a little bit of a conversation with some colleagues a while ago. In my view MEF is for "extensions" to your application rather than dependencies. The case you have looks more like dependencies. So you would be better off using an IoC container to manage your dependencies. You can have multiple ISecondInterface instances injected in with different keys and then choose which one to use.</p> <p>If you feel MEF is more suited to your requirements you can still do this by changing </p> <pre><code>public class Foo { [Import] public IFirstInterface firstImport; [ImportMany] public Collection&lt;ISecondInterface&gt; secondImport; // ... } </code></pre> <p>and then deciding which one to use.</p> <p>Having said that, the case for having one service that deals with two different entities talking to two different repositories is debatable. If you have some common logic you could refactor that out, but it would be better to have two distinct services each with the dependency it requires to do it's work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload