mef

Issues with Entity Framework Self Tracking Entities and ASP MVC .NET and Managed Extensibility Framework

BIG EDIT: This problem is probably being caused by MEF! I'm using a service oriented architecture and have all my MVC controllers perform actions through the services. I have a base service that looks like this: public abstract class BaseService { protected MyObjectModel context; public BaseService() { co...

loading plugins at runtime with MEF

helos, my application allows users to write plugins (implementing IPlugin) that they can instantiate at runtime. on startup a directory of plugin .dlls is parsed, registering all the available plugins infos. at runtime a GUI is provided that lets users create instances of any of the plugins. this works. but now i see MEF and hope i ca...

Using MEF as an IoC

Hi all, After reading some stuff such as this: http://mikehadlow.blogspot.com/2008/09/managed-extensibility-framework-why.html I understand that MEF has some featcures that I will not find in an IoC, and that MEF has some IoC stuff that is probaboly not as advanced as some other IoC systems can offer. I need the MEF stuff. Do I also n...

How to import several instances with MEF ?

I have coded a service like that : public interface IMyInterface { ... } [Export(typeof(IMyInterface))] internal class MyService : IMyInterface { ... } Now, I'd like to import several instances of MyService with MEF in my main program. How can I do that ? With [Import] private IMyInterface MyService { get; set; } I only get 1 i...

MEF: DirectoryPartCatalog

Hi, I'm trying to write a simple MEF demo to learn about it. I'm following this tutorial, but it seems to be outdated. The downloadable example works, but it uses an included assembly that is 2 versions older (2008.9.4.0) than the current one (4.0) that ships with Framwework 4. In particular, it uses DirectoryPartCatalog that I cannot ...

Composing MEF parts when delivered via XBAP

Hi Does anyone have any examples of using MEF in an XBAP application? Is it even possible? UPDATE * It looks like it is possible, but the location of the component parts is probably different than a 'normal' MEF application. So it looks like the following code isn't quite right - can anyone suggest a change to make it load properly ...

Preventing stale xap files from being served by MEF DeploymentCatalogs

Hello, In the past I had problems with the browser cache serving older versions of the xap file. In order to overcome this I dynamically add a query string parameter containg the last modified date of the xap file to the silverlight source parameter in aspx page. This guarentees that clients will receive the latest xap file and not a ca...

Using MEF and XAML together

MEF is a great framework. I can just put a dll into given directory and when host composition goes the DLL code will run. The question is if it is possible to create objects and use interfaces from XAML description, not from DLLs, in the case? ...

nServiceBus .Net 4.0 and MEF

So I've been tinkering in the last few days with nServiceBus. Here a few things that I want to know. How do I get a version that will play nice with .net 4.0? I'm using NServiceBus.2.0.0.1145 which I believe is the lastest but I needed to convert the sample solutions to VS2010 (which works fine) but their target framework is 3.5. Also...

Configure and expose a singleton to all modules in a MEF/PRISM application

I have an application (just a test) which uses MEF and PRISM. It's quite easy to load some exports that conform to specific interfaces and pass them to the constructor of the modules that are being loaded, but I'm trying to do something different. When the application starts, it imports an implementation of IControllerClient. The creat...

How can I use CAS in .NET 4 to lock down my MEF extensions?

I have an application in .NET 4 that uses MEF for extensibility. My main application has three assemblies: Host, Application and Contracts. Host is the "boot-strapping" executable that creates the container and does the composition. Application contains the logic of my application, and more extension points for 3rd parties. Contracts...

Can a MEF application built on .NET 4 import types built against .NET 3.5?

I am developing a host application using Managed Extensibility Framework and it's built against .NET 4 and the System.ComponentModel.Composition assembly that is built into the framework. I would like to support the ability to develop parts using .NET 3.5 and export them declaratively. Since the export attributes are new in .NET 4 and t...

Own extensibility layer or MEF/MAF?

For those that work with application extensibility in .NET, what do you prefer doing - creating your own extensibility layer or using MEF (Managed Extensibility Framework) or MAF (Managed Add-in Framework)? So far, I've used both ways of implementing application extensibility and I like MEF for the fact that it makes it easier to load e...

MEF Import - Object reference error

I'm trying to figure out why one of my objects does not seem to be satisfying its Import. I think it may be the way I am using the container.ComposeParts() function but I have not been able to find much documentation with regards to it. I have four projects MEF.Service.Contracts MEF.Service.Messaging (implements contracts) MEF.Service.C...

Simple Plugin with MEF .How Can I load plugin using a config File

Hi, I am writing a small plugin architecture and I have decided to use MEF I have been told that we must use a config file. Is there any example out there that that uses Mef and a config file? All I need is how to set up mef in a config file is this possible? This is a small noddy example I have built to test it I am missing the load...

MEF Load Plugins(dlls) from folder not in Executing assembly but another dll.Can you help?

Hi all I need to implement a very small plugin architecture.I am new to MEF so even simple things become complex. Lets assume I have 2 dlls Client(Executing Assembly) and Server Within Server I have a folder called "Plugins" Usually I create a "Plugins" folder in the bin directory of the executingAssembly and all works with this piece o...

MEF: how to import from an exported object?

I have created a MEF plugin control that I import into my app. Now, I want the plugin to be able to import parts from the app. I can't figure how setup the catalog in the plugin, so that it can find the exports from the app. Can somebody tell me how this is done? Below is my code which doesn't work when I try to create an AssemblyCat...

Managed Extensibility Framework, Interception and Dynamic Proxy

easy task, but couldn't find any direction. i want to intercept object creation of MEF and return proxy (using castle dynamic proxy) of my object either then the object itself. is it possible to do that? ...

How can I type safely load code from multiple sources that deal with an unknown type?

I need to be able to, at runtime, load two classes that share an unknown type, like this: interface IProducer<out A> { public A CookOne(); } interface IConsumer<in A> { public void EatOne(A food); } The entire list of possible involved types can't be known at compile time because they don't exist yet. The software that uses t...

Should I unit test a class for having MEF attributes?

I want to refactor a DLL to make it MEFable too. Should I unit test whether a class is decorated with [Export] or [Import] and other MEF attributes? ...