mef

MEF and WCF - Issues with AppDomain

I am currently running the latest preview (#8) and I am working with WCF services. I use MEF to read in the WCF Service Libraries. I have noticed that whenever I do any operation on one of the libraries from the application that read in the libraries, those WCF libraries have an AppDomain of 1, but whenever a WCF Service gets a notificat...

MEF exception " 'SourceProvider' must be set."

I am playing around with the new System.ComponentModel.Composition namespace in .NET 4.0 beta 2, also known as the Managed Extensibility Framework. I use the following C# example where a Monkey imports a Banana: public interface IBanana { } [Export(typeof(IBanana))] public class Banana : IBanana { } public class Monkey { [Im...

Mixing MEF parts targetting .NET 3.5 with an application targetting .NET 4.0

The Managed Extensibility Framework is both a stand-alone project (currently targetting .NET 3.5) and part of the .NET 4.0 framework. Suppose I create assemblies targetting .NET 3.5 that contain MEF parts. These assemblies will reference the stand-alone version of System.ComponentModel.Composition.dll. Now suppose I create a MEF-enabl...

Can't load multiple MEF parts

I have a Winforms desktop application that is loading multiple MEF parts with the same Interface type. Problem: When I try to load more than one of the same type I get the following exception: The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition er...

MEF or a Provider Model?

I'm working on a project that is currently using MEF to import extensions for a console application. I'm looking at the ability to provide more than just console-based output for the application that can be configured to the needs of the user. I am wondering which way to go in order to provide the extensibility to the output functionali...

Having Entity Framework trouble

I'm trying to add a ProfileProperty into the ProfileProperties table using ObjectContext.AddObject. The db fields for the ProfileProperties table are: ProfilePropertyID ProfilePropertyDefinitionID UserID PropertyValue The db fields for the ProfilePropertyDefinitions table are: ProfilePropertyDefinitionID PropertyName The variables...

MEF Constructor Injection

I'm trying to figure MEF's Constructor Injection attribute. I have no idea how i tell it to load the parameters to the constructor. This is property i'm trying to load [ImportMany(typeof(BUsers))] public IEnumerable<BUsers> LoadBUsers { get; set; } Here is the code that i use to import the assemblies. try { va...

Getting legacy objects to be imported when they are not attributed as Exports in MEF

I'm starting to use MEF to build up a plugin based application, and I'm slowly adding MEF to the mix. There is a lot of existing code that does not have any MEF DNA yet, but I still want to get that code into the new objects that are being automatically created by composition. Let's make this concrete. I have a list of objects that im...

MEF Contrib Provider Model Not Importing Parts

I have been trying to use the configurable provider model for handling my MEF imports and exports from MEF Contrib (link). I've read the Codeplex documentation and Code Junkie's blog post (link); however, I can't seem to get the container to create the parts. Where am I going wrong? Program.cs namespace MEFTest { class Program ...

Where can I learn about MEF?

I watched the DNR TV episode with Glenn Block and it looks like MEF would be useful for my company. I am trying to find out more information on it's strengths and weaknesses and some sample projects that use it. Are there any good blogs/tutorials on using MEF? Note: I use C#, so if the examples are in C#, that would be awesome. ...

Asp.net MVC - How to achieve flexible modules to be used cross-project?

Hello, I´m not looking for code directly, but for some ideas how to solve my problem the best. There is this asp.net mvc application I´m working on. It should be "highly modular" and many parts have to be reused across different projects. Our current approach is using the Managed Extensibility Framework to import assemblies at runtime...

Lambda expression example with System.Action<T> for a MEF case?

I am new to System.Action<T> and Lambda expression. Here is one case I would like to use. using System; using System.ComponentModel.Composition; public class MyClass { public static CompositionContainer Container = new CompositionContainer(); private void Initialize(Action<CompositonBatch> action) {} public MyClass() { ...

Dynamically load .dlls from network share not browsable on client PC -- WCF?

I'm architecting a WPF application using the PnP Composite Application Guidance. The application will be run locally, within our intranet. Modules will be loaded dynamically based on user roles. The modules must therefore be accessible to the application through a network share, thus accessible from the client machines. What I'd like t...

Using ImportingConstructorAttribute

Hi, I'm trying to build a WPF application using MEF and MVVM. I'm exporting my ViewModel but I want my ViewModels to accept a Model parameter in the constructor: I will create a specific Model and supply it to ViewModel's constructor. I've tried to understand how ImportingConstructorAttribute works, it seems like it is the way to have a...

Writing Visual Studio 2010 Plugin, would like to show a toolbox like Resharper in code editor.

Hello, I would like to write a plugin for Visual Studio 2010 but in fact I face some problems. What I want to do seems easy, I would like that a little toolbox appears when selecting the text in code editor like in Resharper (little pen with menu that helps in refactoring) or like here: http://www.axtools.com/products-vs2010-extensions...

How do I create an Editor Option in the new VS2010 Editor Extensibilty

The list of extensibility points for the VS2010 Editor mentios creating EditorOptionDefinitions along with a small sample. When I attempt to do this I cannot find the options anywhere in the VS2010 UI. How do I create these so that they are surfaced in the UI? ...

ViewModel communication question

Imagine I have a UserControl that shows a parking lot (my favorite analogy) with cars of different colors. You can select a car, and in a separate UserControl (in a separate project) statistics of the selected car are displayed. Now a user wants a button on the car statistics UC, 'Next car of same color'. When selected it should show ...

How to use MVVM and MEF with DataTemplate?

I am trying to use MEF on a new project within my application. Things work at the main app level, but in this separate project whose assembly is included in the main app (its a UserControl) I am wondering about something... If I have a UserControl, and in it I have the following: <UserControl.Resources> <DataTemplate DataType="...

What is the Managed Extensibility Framework (MEF)?

I googled and got only a few articles about MEF. Would someone please explain in brief: What is the Manage Extensibility Framework? For what purpose is it needed? How can I start working with it? Any step by step guidance will be helpful, thanks! ...

Dispose components by MEF container?

I use MEF to map interface to implementation class as a way of DI. For example, I use the Import attribute for an interface, and Export for implementation class. My understanding is that the MEF framework will create the implementation class instances and hold them in MEF's container for use or auto-injection. Some of my implementation ...