mef

How can I set PrivateBinPath in MEF?

How can I set PrivateBinPath in MEF? This is what I'm trying to do : http://stackoverflow.com/questions/806383/how-to-change-the-loading-path-of-references-in-net ...

How can I use Rhino Mocks to mock a MEF export?

With reference to the Managed Extensibility Framework (MEF), I'm trying to work out how to create clean tests with mocks. I have an exported component which has three private imports. Each imported object (field) needs to be mocked. Given that the CompositionContainer uses fancy reflection tactics to set imported private fields of compo...

MEF creation policy

I am attempting to use the shared part creation policy for a MEF export. It does not, however, seem to work the way I was thinking. I do the composition twice in my application and each time get a fresh copy of the object. I've proved this by adding an instance counter to the object instanciation static int instCount = 0; pu...

Choosing between MEF and MAF (System.AddIn)

The Managed Extensibility Framework (MEF) and Managed AddIn Framework (MAF, aka System.AddIn) seem to accomplish very similar tasks. According to this Stack Overflow question, Is MEF a replacement for System.Addin?, you can even use both at the same time. When would you choose to use one vs. the other? Under what circumstances would yo...

Using MEF to import a WPF DataTemplate?

I was looking at MEF as an extensibility framework, and I'm pretty much sold, except for one point: Let's say I want to import both a ViewModel and a View to display it. I think the "right" way to do that is for the MEF part to export a ViewModel class, and a DataTemplate that displays the ViewModel. As an example, say you were buildi...

In C# 3.0 we use "var" what is its alternative in C# 2.0?

I am learning plug able architecture in .Net using Managed Extensibility Framework (MEF.) I saw sample code on the net, but when I tried to implement it I got stuck at one point. The code was using: var catalog = new AttributedAssemblyPartCatalog(Assembly.GetExecutingAssembly()); var container = new CompositionContainer(catalog.Creat...

Looking for a simple MEF code sample

I'm looking for a simple code sample showing how to use Microsoft Managed Extensibility Framework (MEF). I really like the code at http://blogs.msdn.com/brada/archive/2008/09/29/simple-introduction-to-composite-applications-with-the-managed-extensions-framework.aspx, but it was written for MEF CTP 2 or 3 and the syntax has changed fo...

How to enumerate assemblies within AggregateCatalog or DirectoryCatalog in MEF?

I have a MEF (Microsoft Extension Framework) application which loads some assemblies from a folder. I need to enumerate the assemblies that produced any exports for my application. One way to do it is to enumerate imports calling GetExportedObject().GetType().Assembly. But it would be cleaner to do this without instantiation of imports...

Deserialization error in MEF due to missing assemblies

I'm using MEF. I serialize one of the objects which relies on one of the loaded assemblies. Now when I try to deserialize this object it throws "Unable to find assembly" exception. MEF loads the assemblies before this deserialization in another class (I assume that the scope of this is application wide, it loads them into a public prop...

Help Required in MEF (Managed Extensibility Framework)

hi there. i am currently working with MEF and facing some problems what i want is to load dlls from the directory. first i scan the directory and save two things in dictionary Name property from respective DLL (as string) and Module Name (as string) here is ScanDirectory() code private void ScanPluginDirectory() { ...

Import part with specific meta data using MEF Preview 5

I have a export defined as as follows in MEF preview 5 [ExportMetadata("Application", "CheckFolderApplication")] [Export(typeof(ExtendedArtifactBase))] public class CheckFolderArtifact2 : ExtendedArtifactBase { ... Then I only want those imports with the "Application" "CheckFolderApplication" metadata. To currenly do that I read all t...

Managed Extensibility Framework (MEF) vs. Composite UI Application Block (CAB)

We are currently looking at either using CAB or MEF for our next application. I didn't see any examples on codeplex of how event brokering is handled for sibling control communication, maybe I missed it. How does inter-control communication work in MEF? Also, we are planning on using Infragistics which has provided additional compon...

Part specific settings with MEF

Hi, We have an interface which will be implemented by classes that take care of data transport across the network or com ports for example. Let's call it IDataTransporter for now and we have 2 implementations: ComPortDataTransporter and TcpDataTransporter. Obviously these two require very different configuration. The first has setti...

Importing parts from X number of folders using MEF

I have a number of folders that all contains MEF parts that should be imported. Is the easiest way to find all the parts to iterate over the folders and create a MEF Aggregating Catalog object? I need to place the parts in different places in the application based on the folder it was read from. So parts from folder "Test1Parts" should ...

Best approach to extensibility on node types and context actions in Forms treeview

I'm working on a Visual Studio Add-in for Visual Studio 2008 that display a treeview that provides a view on content in a server product. The server product contains different types of nodes, and each node has its own type of context menu (right click menu). For new types of nodes and the actions connected to a node I currently just add...

Creating multiple instances of Imported MEF parts

Hi, Currently my WPF application imports a part like this [Import(typeof(ILedPanel)] public ILedPanel Panel { get; set; } But this gives ma a single intance of the class that implements ILedPanel. What I really want to do is have the ability to create as many instances that I need. Please note there is only one Export for ILedPanel i...

MEF and WCF

I'd like to use MEF for instantiating the dependencies in an application that has several WCF services hosted in IIS. The different services depend on shared components and I'd like MEF to manage the instantiation and injection of these. Where should I perform composition? Initially I thought of having a CompositionContainer in an IInst...

Would MEF work for a product?

We have developed a product (Core). We extend and override functioanlity in Core to create bespoke applications (Product). Product has a reference to Core so it can inherit from the base forms and override the functionality. Would MEF be n advantage here or is it more for plug-ins? Thanks, B ...

Using MEF for pluggable architecture in MVC

Ok I got a strange issue that I hope someone could help with I have a MVC project based upon this demo http://blogs.msdn.com/hammett/archive/2009/04/23/mef-and-asp-net-mvc-sample.aspx However it has a problem when specifying a strongly typed view I get this error Parser Error Description: An error occurred during the parsing of a r...

MEF: Mark interface for export

Is it possible to mark an interface for export, so that all derived classes will be available for import? [Export( typeof( IMyInterface ) )] public interface IMyInterface { ... } [Import( typeof( IMyInterface ) )] private readonly ICollection<IMyInterface> m_Concretes = new Collection<IPlugin>(); I don't know which classes are implem...