mef

Mef and Configuration File Settings

Hi, New to Mef so I m on a discovery tour. I was wondering whether you could read from Configuration file like Unity does. I mean configure an Interface and mapto a class and sort of resolve it. Lets take an example "Plugins" I could take the approach of creating a folder "Plugins" and MEF would happily read all the plugins. What about...

MEF - How can i use an ExportProvider to select just one Export

hi, i really dont get it work. say i have some classes with the same interface which i want to export. [Export(typeof(IService))] [ExportMetadata("ExportType", typeof(Service1))] public class Service1 : IService {...} [Export(typeof(IService))] [ExportMetadata("ExportType", typeof(Service2))] public class Service2 : IService {......

Can MEF be used to get the System.Type of classes marked [Export]?

I've been successfully using MEF to obtain exported class instances. However, I came across a situation where I need to enumerate a set of exported derived classes without instantiating them. I've looked up CompositionContainer's documentation and it only seems to be able to return object instances. I know I could have a static Type fie...

Problem with dynamic loading XAP files with MEF. IE is crashing.

Hello, i am having a huge problem with MEF when i am trying to dynamic load XAP files. When i am download the catalog/xap file with the the method call dc.DownloadAsync(); My Internet explorer will crash and show me the "IE has stopped working" dialog. (see image belove). I have followed several steps by steps guides and i just cant see...

Tracking instances created by a MEF container.

Hello, I'm using MEF to create several instances of the same export. I'd like to keep track of the instances I have created, and am either querying the container or using a recomposited collection, but I never get my instances... Here's the code: interface IFoo{}; [Export(typeof(IFoo)),PartCreationPolicy(CreationPolicy.NonShared)] cl...

How to deploy an MSBuild custom Task using MEF?

I have a number of custom Item and Project Templates for Visual Studio 2010. I have build a VSIX Package that can be used to deploy these extensions to multiple developer's machines. I am now creating a custom MSBuild Task that will be required for a new Item Template. In my local project, I can get this to work by putting in a hard-co...

Issue recomposing on an ImportMany with MEF

I've got a property defined on a class that has the importManyAttribute defined for it, the declaration is as follows: public const string FontStyleProvidersPropertyName = "FontStyleProviders"; [ImportMany(typeof(IFontStyleProvider), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition=true)] public List<IFontStyleProvider...

How can I avoid redundant imports in MEF?

Here's the issue... if I use, say a directory catalog in MEF and have some.dll and copy of some.dll, i will get double the exports, even though they are defining the same type, is there a way to resolve this? EDIT: the problem isn't with this particular issue, this is just an abstract example of a real issue, for instance, if i have an ...

MEF: How to manually configure Export for a contract implementation

Hi, I have a MEF's CompositionContainer, a contract (say IFoo) and a module (Prism module but it doesn't matter much here, just some component). I want in my module to register the contract's implementation (FooImpl). If it's Unity I'd do like this: unity.RegisterType<IFoo, FooImpl>(). That's all. With MEF I've puzzled. I have to mar...

Is there a tutorial, code project, or example of using MEF to extend the Vs2010 solution explorer context menus?

I have an existing legacy style IDTExtensibility2, IDTCommandTarget Extension that I would like to remake using MEF for vs2010, but I can't find any resources concerning VS2010 MEF and context menu changes. If it happened to be deployable via .vsix all the better. Are there resources out there specific to MEF based context menu extensio...

Can you hydrate a static property using MEF?

can I hydrate this inside the class's static constructor? public class Connect:IDTExtensibility2, IDTCommandTarget static Connect() { //hydrate static properties? } [Import] public static Action<ProjectLogicChecks> Display { get; set; } [Export(typeof(Action<ProjectLogicChecks>))] private static void Displ...

Problem with Silverlight and MEF

I've refferenced my project to the MEF's dlls System.ComponentModel.Composition.dll System.ComponentModel.Composition.Initialization.dll from C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client But the compiler doesn't recognize the PartInitializer. Why ?! ...

How to redirect an assembly reference from GAC version to private assembly which differ only by revision

Hi, I'm trying to use MEF2 Preview in my .NET4 project. MEF2 Preview version is "System.ComponentModel.Composition.Codeplex" file with "System.ComponentModel.Composition, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" assembly name. So it only differs by revision number from the version in .NET/GAC (which is 4.0.0.0)...

Using [ImportingConstructor] to import calling object into constructor parameter using MEF

I am in the process of converting some of my code to MEF from a proprietary system that sort of does the same thing as MEF, and I have a question about how I would accomplish the following problem that I recently ran into. I have a typical entity object that looks something like this: public class Account { [Import] public IAc...

adding exported parts to an exisiting MEF container

Is there a way to add exported parts from a catalog to an existing MEF CompositionContainer? I'm aware of ComposeExportedValue extension method, but what if I wanted to add a whole DirectoryCatalog to the list of exports? I don't need recomposition in this case, btw. ...

pro's and cons of MEF vs Portable Areas via MvcContrib for collaborative programming

I've been looking into MEF and Portable areas and the pro's and cons of using these in a collaborative programming environment. I've found the following article http://www.thegecko.org/index.php/2010/06/pluggable-mvc-2-0-using-mef-and-strongly-typed-views/ which states MEF was chosen over other solutions such as Portable Areas ...

mef and windowsAPICodepack

Hi stackoverflow fellas, I've got a problem which at first looks solved but I can't get it to run. I've got one WPF application project in my solution and a WPF class library which is added at runtime via MEF. In this external Dll I use the TaskDialog of the Codepack. Ok I found the manifest dependency thing and added it to my main WP...

How do I get a MEF Directory catalog looking at the same directory for both the Servicelayer and DAL?

Hi, I'm using MEF to add plugins to our DAL which is used by our WebApp. This works fine, but when our service layer references the DAL, it's looking for plugins in \ServiceLayer\Plugins\ rather than \WebSite\Plugins\ (which makes sense are we're using a relative path. {DirectoryCatalog (Path="plugins/")}. The problem is if we use an ...

MEF. How to clean up the default container?

I'm trying to implement Logout operation in my Silverlight client. During Login operation, MEF initializes DefaultContainer with instances of the [Export]-ed singleton classes, which contain user-specific information (like password). Is there a way, to re-initialize/reset/drop MEF infrastructure/DefaultContainer like it was never initi...

Can't find System.ComponentModel.Composition with .NET Framework 4 installed

i think this sounds like a stupid question. i am starting with caliburn micro: customizing the bootstraper. i have .NET Framework 4 installed, VS2010. but when i try to add a using, there is intellisense that tells me i have System.ComponentModel.Design but no Composition or any of using System.ComponentModel.Composition; using System.C...