mef

Does MEF require .NET 4?

I am using Visual Studio 2010, try to create a MEF application. Does this require .NET 4.0 or can I target .NET 2.0? ...

Bind selected value on combobox to view model

Hi, I have my silverlight app which pulls data into a datagrid from a view model. The vm is exposed via Mef. I also have a details grid which has comboboxes. The vm also contains the data to populate the combobox values. Upon first load, everything works fine and the selected items on te comboboxes are correct and I can select alternati...

Dynamically adding Views in Silverlight & MVVM

Hi all, I am starting to re-write my whole silverlight business application in the MVVM pattern; My first stop-point is this: I have a page (View1) with corresponding ViewModel1 (with a property 'IEnumerable AllData'); Now, within this View, I want to have i.e. a tree-view control, in which one node will be populated with another View...

Xap file contents changes if built in Visual Studio or build server

I'm using MEF with my Silverlight 4 app to dynamically load xap files. To optimize this process, I've removed various assemblies from my xaps since I know they've already been loaded by the base xap. This reduces the size of my dynamically loaded xaps. I accomplished this by setting the "Copy Local" flag for each assembly reference to "f...

How can I prevent MEF from throwing an exception when an Export is not found?

I have a class with an IList<T> property decorated with the [ImportMany(allowRecomposition = true)] attribute. There are some conditions in which the application might not find any available Exports of the requested type. Right now, it's throwing a CompositionException if no Exports of the requested type are found. I dislike application ...

MEF Error message

Can anybody explain this error message: The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) No valid ex...

When to use MEF

I tried Unity and MEF and plain old new. And I am a bit confused as to when exactly you need to use any of these "patterns". Why would I choose to use MEF or Unity if using new is simpler and satisfies my needs. In other words, what needs justify the use of MEF or Unity? ...

Registering instances with MEF

I have to register an object instance into a container. I can't use the generic ComposeExportedValue<T> since I don't know what T is at compile time. The method I need is something like this: container.RegisterInstance(Type someType, object instance) Any ideas? Thanks. ...

How does MEF affect your application load times?

Hi all I'm currently investigating MEF to know the feasibility of some kind of plugin subsystem for a software we are writing at my company. One of the first questions that came to my mind is to know the influence of MEF components in the application load time. Moreover, if that's something of significant weight, is it possible to load...

Importing MEF-Plugins into MVC Controllers

Hello. There are several examples of using MEF to plugin whole controller/view packages into a MVC application, but i didn't found one, using MEF to plugin funcional parts, used by other controllers. For example, think of a NewsService with a simple interface like interface INewsService { List<NewsItem> GetAllNews(); } That gets ...

MEF and unit testing with NUnit

A few weeks ago I jumped on the MEF (ComponentModel) bandwagon, and am now using it for a lot of my plugins and also shared libraries. Overall, it's been great aside from the frequent mistakes on my part, which result in frustrating debugging sessions. Anyhow, my app has been running great, but my MEF-related code changes have caused m...

How to display a UserControl with satisfying all imports

Dear SO, I'm having some issues with Silverlight 4/ MEF. I have a basic framework setup with a Silverlight Navigation app at the core. Image link to the diagram for clarification The main app (Desu) contains some pages and controls that export en import nicely. I dynamicly load controls from Desu.Controls(like an imageviewer which i ...

Question about mixing MEF and Unity

I'm finally diving into Unity head first, and have run into my first real problem. I've been gradually changing some things in my app from being MEF-resolved to Unity-resolved. Everything went fine on the application side, but then I realized that my plugins were not being loaded. I started to look into this issue, and I believe it's ...

Multiple Instances of a single MEF DLL

Apparently .NET 4.0 does not have the PartCreator/ExportFactory for non-SL. Which is something I think I need for this. I was wondering if someone can help me (with an example please) of how to create multiple instances of the EXPORTED type in a DLL. Basically say I have a DLL that contains a type ConsoleLogger and it uses the interface...

C# - Help with LINQ

I need to check if a certain property exists within a class. Please refer to the LINQ query in question. For the life of me I cannot make the compiler happy. class Program { static void Main(string[] args) { ModuleManager m = new ModuleManager(); IModule module = m.FindModuleForView(typeof(HomeView)); Con...

using MEF with NHibernate and windsor

I have an ASP.net MVC application that is using NHibernate under the covers for data access. I'm using the Windsor container to handle injecting ISession references into each controller. This works great, but now I'm looking to expand my application with a pluggable architecture so that I can have a core product and specific add-ons. ...

Robust C# Plugin System

I am writing a tool which communicates with more than one version control system, either subversion or clearcase, and has various utilities which can be plugged into it. I though of using MEF to load the version control providers, and utiilities, both of which have interfaces definied for them. I've started to use MEF for this. But if l...

Help getting started with MEF

Hi, I was reading somewhere that with MEF I can simply drop a dll into a directory and my application (with some MEF magic) will be able to read it and execute the code in it? Hopefully only classes that implement an interface that I define?? Can someone help me to get going, with some links maybe for my problem. I've looked through so...

Using MEF, inject into an Import class

I have a logger interface that I inject into many different classes, can I inject that class in say a repository class, which is also an Import class which is injected into other classes? Hope that makes sense, I'm a little confused by it myself. Thx ...

How do I populate a MEF plugin with data that is not hard coded into the assembly?

I am working on a program that will communicate with various pieces of hardware. Because of the varied nature of the items it communicates and controls, I need to have a different "driver" for each different piece of hardware. This made me think that MEF would be a great way to make those drivers as plugins that can be added even after...