<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>MEF Discussions Rss Feed</title><link>http://www.codeplex.com/MEF/Thread/List.aspx</link><description>MEF Discussions Rss Description</description><item><title>New Post: .NET 4.5 Constructor Parameters</title><link>http://mef.codeplex.com/discussions/444488</link><description>&lt;div style="line-height: normal;"&gt;How do I set constructor parameters in MEF2?&lt;br /&gt;
&lt;br /&gt;
I assume there is a better way than changing the implementation with ImportingConstructor + Import ParamName.&lt;br /&gt;
&lt;br /&gt;
If not, what happens if I don't have access to rebuilding the class implementation?&lt;br /&gt;
&lt;/div&gt;</description><author>IsaacAlexander</author><pubDate>Tue, 21 May 2013 22:09:33 GMT</pubDate><guid isPermaLink="false">New Post: .NET 4.5 Constructor Parameters 20130521100933P</guid></item><item><title>New Post: A way to delete/replace a Shared object from the container</title><link>http://mef.codeplex.com/discussions/444350</link><description>&lt;div style="line-height: normal;"&gt;In my PRISM application  I use MEF as a container. Most of my ViewModel are Non-Shared instances, but a couple are Shared due the requeriments (being used among different views).&lt;br /&gt;
&lt;br /&gt;
But in certain moments I need to delete/release those ViewModel instances.&lt;br /&gt;
&lt;br /&gt;
I know that I could make them Non-Shared and use statics methods to share data among the instances, but thats not a clean way to do it.&lt;br /&gt;
&lt;br /&gt;
Is there a way to do it? &lt;br /&gt;
&lt;/div&gt;</description><author>JLuisEstrada</author><pubDate>Mon, 20 May 2013 22:54:38 GMT</pubDate><guid isPermaLink="false">New Post: A way to delete/replace a Shared object from the container 20130520105438P</guid></item><item><title>New Post: NullReferenceException</title><link>http://mef.codeplex.com/discussions/78913</link><description>&lt;div style="line-height: normal;"&gt;Hi all,&lt;br /&gt;
Seems that this post is the only one with the same problem as I have. &lt;br /&gt;
What was the cause of this issue?&lt;br /&gt;
&lt;/div&gt;</description><author>santo2</author><pubDate>Fri, 17 May 2013 09:49:03 GMT</pubDate><guid isPermaLink="false">New Post: NullReferenceException 20130517094903A</guid></item><item><title>New Post: ImportConstructor in class that is being serialized/deserialized</title><link>http://mef.codeplex.com/discussions/443518</link><description>&lt;div style="line-height: normal;"&gt;Thank you for the advice&lt;br /&gt;
&lt;/div&gt;</description><author>jfraschilla</author><pubDate>Wed, 15 May 2013 02:17:20 GMT</pubDate><guid isPermaLink="false">New Post: ImportConstructor in class that is being serialized/deserialized 20130515021720A</guid></item><item><title>New Post: ImportConstructor in class that is being serialized/deserialized</title><link>http://mef.codeplex.com/discussions/443518</link><description>&lt;div style="line-height: normal;"&gt;You could switch to property imports and fix them up post-deserialization, but I'd be concerned about the fragility of mixing parts and serialization this way. As a rule of thumb, things with a 'persistent identity' make poor parts- MEF really wants to be in control of which instance is used where.&lt;br /&gt;
&lt;br /&gt;
In this situation I usually try to separate the serialized and non-serialized data into different (related) classes. This might work for you..?&lt;br /&gt;
&lt;br /&gt;
Good luck!&lt;br /&gt;
Nick&lt;br /&gt;
&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Mon, 13 May 2013 20:52:03 GMT</pubDate><guid isPermaLink="false">New Post: ImportConstructor in class that is being serialized/deserialized 20130513085203P</guid></item><item><title>New Post: ImportConstructor in class that is being serialized/deserialized</title><link>http://mef.codeplex.com/discussions/443518</link><description>&lt;div style="line-height: normal;"&gt;I incorporated MEF into a desktop application in which I serialize and deserialize the object.  I use the ISerializable interface to control my binary serialization.  During regular object instantiation the objects constructor is called in which it has an ImportingConstructor.  How do you get MEF imports when the object is being created during deserializations using&lt;br /&gt;
MyObject(SerializationInfo info, StreamingContext context)?&lt;br /&gt;
&lt;/div&gt;</description><author>jfraschilla</author><pubDate>Mon, 13 May 2013 19:21:42 GMT</pubDate><guid isPermaLink="false">New Post: ImportConstructor in class that is being serialized/deserialized 20130513072142P</guid></item><item><title>New Post: PRISM: Load by MEF new version of the same DLL.</title><link>http://mef.codeplex.com/discussions/442696</link><description>&lt;div style="line-height: normal;"&gt;Hello,&lt;br /&gt;
&lt;br /&gt;
I am using PRISM with MEF. I have a problem which I think I am not able to solve with MEF, but I am not sure.&lt;br /&gt;
&lt;br /&gt;
What I would like to achieve is to load by MEF the new updated version of given module. I am loading a module &amp;quot;A&amp;quot; in runtime by adding new DirectoryCatalog to the AggregateCatalog.Catalogs collection in my class which inherits from MefBootstrapper. And now I would like to load the new version of module &amp;quot;A&amp;quot;, i.e. the DLL name is the same, module class name is the same, just different code inside.&lt;br /&gt;
&lt;br /&gt;
When I am adding new DirectoryCatalog which holds the new version of DLL with module &amp;quot;A&amp;quot; then I get exception:&lt;br /&gt;
&lt;blockquote&gt;
Activation error occured while trying to get instance of type RegionAdapterMappings, key &amp;quot;&amp;quot;&lt;br /&gt;
&lt;/blockquote&gt;
Is this what I would like to achieve possible with MEF and PRISM? Thank you for help.&lt;br /&gt;
&lt;/div&gt;</description><author>user3289271</author><pubDate>Mon, 06 May 2013 15:17:06 GMT</pubDate><guid isPermaLink="false">New Post: PRISM: Load by MEF new version of the same DLL. 20130506031706P</guid></item><item><title>New Post: MEF2 with MVC4 via Microsoft.Composition</title><link>http://mef.codeplex.com/discussions/389317</link><description>&lt;div style="line-height: normal;"&gt;For anyone that is still trying to get MEF with MVC4 with full WebApi &lt;a href="http://blog.longle.net/2012/09/28/ioc-dependency-injection-manage-extensiblity-framework-mef-servicelocator-in-net-4-mvc-4-webapi-idependencyresolver-with-closed-classes-e-g-twilio-apis/" rel="nofollow"&gt;http://blog.longle.net/2012/09/28/ioc-dependency-injection-manage-extensiblity-framework-mef-servicelocator-in-net-4-mvc-4-webapi-idependencyresolver-with-closed-classes-e-g-twilio-apis/&lt;/a&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>lelong37</author><pubDate>Thu, 02 May 2013 23:11:32 GMT</pubDate><guid isPermaLink="false">New Post: MEF2 with MVC4 via Microsoft.Composition 20130502111132P</guid></item><item><title>New Post:  Temporary directory</title><link>http://mef.codeplex.com/discussions/441994</link><description>&lt;div style="line-height: normal;"&gt;I've just deployed an WCF service application that uses MEF to a QA environment and an issue jumped up and bit us.  The security context under which the application is running must have read/write access to C:\windows\temp or strange things happen.  The application loads, but when I try to access a custom section in my web.config, ConfigurationManager.GetSection returns a null.  Through trace output, I get messages that looked like this:&lt;br /&gt;
&lt;br /&gt;
Unable to generate a temporary class (result=1).&lt;br /&gt;
error CS2001: Source file 'C:\WINDOWS\TEMP\pmgl4mnt.0.cs' could not be found&lt;br /&gt;
error CS2008: No inputs specified&lt;br /&gt;
&lt;br /&gt;
When I grant access to the proper user, everything works great.&lt;br /&gt;
&lt;br /&gt;
Is it possible to configure MEF to use a different directory?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Todd&lt;br /&gt;
&lt;/div&gt;</description><author>CyberTodd</author><pubDate>Mon, 29 Apr 2013 18:42:49 GMT</pubDate><guid isPermaLink="false">New Post:  Temporary directory 20130429064249P</guid></item><item><title>New Post: Generic out of work when Use RegistrationBuilder  </title><link>http://mef.codeplex.com/discussions/441264</link><description>&lt;div style="line-height: normal;"&gt;I would like to just use RegistrationBuilder  to create parts.&lt;br /&gt;
example:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;public interface IModel
{
    String Name { get; }
}

public interface IRepository
{
}

class ModelOne : IModel
{
    public String Name { get { return &amp;quot;ModelOne&amp;quot;; } }
}

class ModelTwo : IModel
{
    public String Name { get { return &amp;quot;ModelTwo&amp;quot;; } }
}

public interface IRepository&amp;lt;TModel&amp;gt; : IRepository where TModel : IModel
{
    IContext&amp;lt;TModel&amp;gt; Context { get; set; }
}

public class Repository&amp;lt;TModel&amp;gt; : IRepository&amp;lt;TModel&amp;gt; where TModel : IModel
{
}

    static void Main(String[] args)
    {
        var builder = new RegistrationBuilder();
        builder.ForTypesDerivedFrom&amp;lt;IModel&amp;gt;()
            .Export()
            .Export&amp;lt;IModel&amp;gt;();
        builder.ForTypesDerivedFrom&amp;lt;IRepository&amp;gt;()
            .ExportInterfaces();
        var asmCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly(), builder);
        var container = new CompositionContainer(asmCatalog);
        var one = container.GetExportedValue&amp;lt;IRepository&amp;lt;ModelOne&amp;gt;&amp;gt;();
        var two = container.GetExportedValue&amp;lt;IRepository&amp;lt;ModelTwo&amp;gt;&amp;gt;();
    }
&lt;/code&gt;&lt;/pre&gt;

I can not get the results(the one,the two) I want。&lt;br /&gt;
&lt;br /&gt;
because when i use RegistrationBuilder the all type when wrapped in ProjectingType,but  GetExportedValue method did not wrap Generic Parameters  in ProjectingType.&lt;br /&gt;
&lt;br /&gt;
My temporary solution is to modify the  ImportDefinition.Metadata to make sure the Generic Parameters wrapped in ProjectingType.&lt;br /&gt;
&lt;br /&gt;
is there any good solution or correction?&lt;br /&gt;
&lt;/div&gt;</description><author>starpeng</author><pubDate>Tue, 23 Apr 2013 09:42:12 GMT</pubDate><guid isPermaLink="false">New Post: Generic out of work when Use RegistrationBuilder   20130423094212A</guid></item><item><title>New Post: Plugins with Common Dependencies?</title><link>http://mef.codeplex.com/discussions/441190</link><description>&lt;div style="line-height: normal;"&gt;Hi All,&lt;br /&gt;
&lt;br /&gt;
So, I have been using MEF for a little while, I've written several plugins for an app already which work very well - they all use MVVM and the resources are all injected ok so far.&lt;br /&gt;
&lt;br /&gt;
But... I have come across a problem, I have 3 plugins, P1, P2 and P3. Each one is using the Infragistics libraries to display data.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am also using Click Once, so I have a Plugins Dir with the Dll's from my plugins linked, so that Click Once will deploy the Dll's. OK So far.&lt;br /&gt;
&lt;br /&gt;
So, when I install on a machine that does not have the Infragistics Libraries installed it does not work. I cannot deploy the dependencies with each plugin (VS will not let me add multiple links to the same file, and also, there are going to be at least 10 plugins at the end, if each is using the same 10mb dependencies...)&lt;br /&gt;
&lt;br /&gt;
So, I tried using the probing privatePaths to try and get a common dir that I can put common dependencies into, but I'm not having much luck.&lt;br /&gt;
&lt;br /&gt;
Has anyone come across this problem before? if so, how should I overcome this problem?&lt;br /&gt;
&lt;br /&gt;
Thanks for all advice!&lt;br /&gt;
&lt;br /&gt;
Scott&lt;br /&gt;
&lt;/div&gt;</description><author>ScottMacleman</author><pubDate>Mon, 22 Apr 2013 18:52:58 GMT</pubDate><guid isPermaLink="false">New Post: Plugins with Common Dependencies? 20130422065258P</guid></item><item><title>New Post: Preserve Multiple Metadata Order</title><link>http://mef.codeplex.com/discussions/440882</link><description>&lt;div style="line-height: normal;"&gt;I have the following exported function:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[Export(typeof(System.Func&amp;lt;object&amp;gt;))]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 1&amp;quot;, IsMultiple = true)]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 2&amp;quot;, IsMultiple = true)]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 3&amp;quot;, IsMultiple = true)]
public object TestFunction() {return null;}&lt;/code&gt;&lt;/pre&gt;

Problem is, when the function is imported, the order of the metadata IDictionary&amp;lt;string,object[]&amp;gt; is not preserved according to the order they are declared, which is important in my application.&lt;br /&gt;
&lt;br /&gt;
Can anyone help with a solution or workaround?&lt;br /&gt;
&lt;br /&gt;
Kind regards&lt;br /&gt;
&lt;br /&gt;
Bright&lt;br /&gt;
&lt;/div&gt;</description><author>sam01</author><pubDate>Fri, 19 Apr 2013 10:08:52 GMT</pubDate><guid isPermaLink="false">New Post: Preserve Multiple Metadata Order 20130419100852A</guid></item><item><title>New Post: ComposeParts Exception due Multitple Metadata entries</title><link>http://mef.codeplex.com/discussions/440490</link><description>&lt;div style="line-height: normal;"&gt;Dear All&lt;br /&gt;
&lt;br /&gt;
My application uses DirectoryCatalog to import parts from third party dlls. The problem I have have is, ComposeParts fails to load every other when a single plugin developer decorates their exports with multiple metadata entries but fails to set IsMultiple attribute to true. This is something I have no control over.&lt;br /&gt;
&lt;br /&gt;
My question is: is there a way I can configure my code so that that invalid metadata attributes like will not cause failure to load all other plugins in the folder?&lt;br /&gt;
OR can I instruct CompositionContainer to ignore exports with this problem?&lt;br /&gt;
&lt;br /&gt;
Thanks in advance&lt;br /&gt;
&lt;br /&gt;
Sam&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[ImportMany]
private IEnumerable&amp;lt;Lazy&amp;lt;object, TDic&amp;gt;&amp;gt; item;

[Export(typeof(System.Func&amp;lt;string, object[], object&amp;gt;))]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 1&amp;quot;)]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 2&amp;quot;)]
public object Subtract(string f, object[] args) {
   return &amp;quot;Evaluate Subtract&amp;quot;;
}

[Export(typeof(System.Func&amp;lt;string, object[], object&amp;gt;))]
[ExportMetadata(&amp;quot;Name&amp;quot;, &amp;quot;Name 1&amp;quot;)]
[ExportMetadata(&amp;quot;Address&amp;quot;, &amp;quot;Address 1&amp;quot;)]
public object Add(string f, object[] args) {
   return &amp;quot;Evaluate Add&amp;quot;;
}&lt;/code&gt;&lt;/pre&gt;

Both Subtract and Add resides in user's class. I want to be able to import 'Add' and ignore 'Subtract' because of the error due to multiple metadata entry without 'IsMultiple' flag being set. Any ideas on what I am doing wrong will be most welcome.&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;/div&gt;</description><author>sam01</author><pubDate>Tue, 16 Apr 2013 17:05:42 GMT</pubDate><guid isPermaLink="false">New Post: ComposeParts Exception due Multitple Metadata entries 20130416050542P</guid></item><item><title>New Post: Using an XML Manifest</title><link>http://mef.codeplex.com/discussions/439558</link><description>&lt;div style="line-height: normal;"&gt;I am trying to figure out how to use an XML Manifest (e.g. contains 'paths' that can define the layout of menu items), kind of like the system in ICSharpCode.Core. I am not using ICSharpCode.Core due to the difficulty getting it to work with DevExpress controls.&lt;br /&gt;
&lt;br /&gt;
Any ideas/suggestions/examples/etc? I may go to Mono.Addins, but I think making that work will be a real adventure. &lt;br /&gt;
&lt;/div&gt;</description><author>Ztgreve</author><pubDate>Mon, 08 Apr 2013 20:36:57 GMT</pubDate><guid isPermaLink="false">New Post: Using an XML Manifest 20130408083657P</guid></item><item><title>New Post: Issue with .net 4.5 MEF</title><link>http://mef.codeplex.com/discussions/439489</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
I am new .net 4.5 MEF, and I am aware of using MEF in .net 4.0. I tried creating an application using MEF in .net 4.5 but when MEF try to create instance of the class it throws the below exception. &amp;quot;The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.&amp;quot; They provided some suggestions about constructor I tried all the possibilities but still I am getting the same error, but when I tried running the same code in VS 2010 it worked without issues. I am using Contracts for MEF with some metadata involved for filtering. Could somebody please help in figuring out the issue.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Bhaskar.&lt;br /&gt;
&lt;/div&gt;</description><author>konkalabhaskar</author><pubDate>Mon, 08 Apr 2013 11:31:54 GMT</pubDate><guid isPermaLink="false">New Post: Issue with .net 4.5 MEF 20130408113154A</guid></item><item><title>New Post: Prism-MEF: Integerate LinqPad to my application as a Plug-in</title><link>http://mef.codeplex.com/discussions/438841</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
i've asked this question before in patterns &amp;amp; practices: Prism but there was no answer so i re-ask same question again.&lt;br /&gt;
I'm using MEF with Prism 4 in developing LOB application and i wonder if it is possible to integerate LinqPad 4 to my application to be launched from menu item or icon within my application and use it as any dialog box . Do MEF has this capability?&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;/div&gt;</description><author>jivara</author><pubDate>Tue, 02 Apr 2013 19:39:58 GMT</pubDate><guid isPermaLink="false">New Post: Prism-MEF: Integerate LinqPad to my application as a Plug-in 20130402073958P</guid></item><item><title>New Post: SQL database in a MEF application</title><link>http://mef.codeplex.com/discussions/438727</link><description>&lt;div style="line-height: normal;"&gt;This question is not geared towards an implementation of MEF per se, but suppose I have a WPF application whose features are dynamically composable through MEF. The application is also backed by a SQL database. There are tables and stored procedures that are feature specific, and there are some that are shared across all features...&lt;br /&gt;
&lt;br /&gt;
Should the database always contain all of the supporting objects for all features regardless of whether they are dynamically composed in an instance of the application? I think that would certainly work and be the easiest solution, but is anyone doing anything different?&lt;br /&gt;
&lt;br /&gt;
Any advice is appreciated.&lt;br /&gt;
&lt;/div&gt;</description><author>jrussel9</author><pubDate>Tue, 02 Apr 2013 00:31:13 GMT</pubDate><guid isPermaLink="false">New Post: SQL database in a MEF application 20130402123113A</guid></item><item><title>New Post: What are all the cases that make an [ImportingConstructor] not load?</title><link>http://mef.codeplex.com/discussions/438665</link><description>&lt;div style="line-height: normal;"&gt;I posted &lt;a href="http://stackoverflow.com/q/15646774/937623" rel="nofollow"&gt;this question&lt;/a&gt; on stackoverflow.&lt;br /&gt;
&lt;br /&gt;
Basically an [ImportingConstructor] is failing to load, then when I allow a specific part to be default, the constructor it is able to load. The confusing part to me is that this value is properly hydrated. It would make sense to me if it came in as default because it would be a sign that my part composition was off.&lt;br /&gt;
&lt;br /&gt;
Looking into it farther, it does not seem to have anything to do with a deep circular reference, since I have tested with that part having no dependencies of its own.&lt;br /&gt;
&lt;br /&gt;
What are the possible causes for this type of behavior?&lt;br /&gt;
&lt;/div&gt;</description><author>nafreem001</author><pubDate>Mon, 01 Apr 2013 13:36:56 GMT</pubDate><guid isPermaLink="false">New Post: What are all the cases that make an [ImportingConstructor] not load? 20130401013656P</guid></item><item><title>New Post: Use MEF to allow only 2 instances at max per application</title><link>http://mef.codeplex.com/discussions/438130</link><description>&lt;div style="line-height: normal;"&gt;Hi there,&lt;br /&gt;
&lt;br /&gt;
Creation policy (e.g. sharing) applies to parts, while one part may have many exports. This is just how the MEF component model works - in most situations this turns out to be useful.&lt;br /&gt;
&lt;br /&gt;
To achieve what you want in a more MEF-like way:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;
Don't make MyClass a part at all:&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;public class MyClass { }&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;
Create a separate class that holds and exports the two instances as properties:&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code&gt;public class MyClassConfig
{
   MyClass _inst1 = new MyClass();
   MyClass _inst2 = new MyClass();

   [Export(&amp;quot;Condition-1&amp;quot;)]
   public MyClass Inst1 { get { return _inst1; } }

   [Export(&amp;quot;Condition-2&amp;quot;)]
   public MyClass Inst2 { get { return _inst2; } }
}&lt;/code&gt;&lt;/pre&gt;

This is the basic approach, anyway - you can tinker with MyClassConfig to implement lazy construction etc. if this is needed.&lt;br /&gt;
&lt;br /&gt;
Hope this simplifies things!&lt;br /&gt;
Nick&lt;br /&gt;
&lt;/div&gt;</description><author>nblumhardt</author><pubDate>Thu, 28 Mar 2013 11:36:00 GMT</pubDate><guid isPermaLink="false">New Post: Use MEF to allow only 2 instances at max per application 20130328113600A</guid></item><item><title>New Post: Use MEF to allow only 2 instances at max per application</title><link>http://mef.codeplex.com/discussions/438130</link><description>&lt;div style="line-height: normal;"&gt;I am using MEF as an IOC in my application. I found myself stuck in a situation where I need exactly two instance at a time for a class in my application (across all threads). I thought it would be easy just by adding export attribute twice with different container name and then using that container name to create two instances.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[Export(&amp;quot;Condition-1&amp;quot;,typeof(MyClass)]
[Export(&amp;quot;Condition-2&amp;quot;,typeof(MyClass)]
[PartCreationPolicy(System.ComponentModel.Composition.CreationPolicy.Shared)]
public class MyClass  {   }&lt;/code&gt;&lt;/pre&gt;

And then get export as&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;Container.GetExport&amp;lt;MyClass&amp;gt;(&amp;quot;Condition-1&amp;quot;).Value
Container.GetExport&amp;lt;MyClass&amp;gt;(&amp;quot;Condition-2&amp;quot;).Value&lt;/code&gt;&lt;/pre&gt;

But this trick did not work. CreationPolicy is ignoring the ContractName and is returning one instance no matter what contract name i use in GetExport. I finally able to solve my problem by using CompsositionBatch&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;cb.AddExportedValue&amp;lt;MyClass&amp;gt;(&amp;quot;Condition-1&amp;quot;,new MyClass());
cb.AddExportedValue&amp;lt;MyClass&amp;gt;(&amp;quot;Condition-2&amp;quot;,new MyClass());&lt;/code&gt;&lt;/pre&gt;

But my question is, Why am I not able to get different instances on the basis of Contract Name. Is it right that Contract name does not matter if CreationPolicy is shared?&lt;br /&gt;
&lt;/div&gt;</description><author>ZafarAyazKhan</author><pubDate>Wed, 27 Mar 2013 09:21:07 GMT</pubDate><guid isPermaLink="false">New Post: Use MEF to allow only 2 instances at max per application 20130327092107A</guid></item></channel></rss>