How to integrate MEF 4.0.0.0 with ASP MVC 4

Aug 22, 2012 at 7:54 AM

Hi,

I would like to use MEF in my ASP MVC 4 application to allow me to inject dependencies based on configuration set in code. I want it mostly for unit-test-ability purposes.

1. Can I use System.ComponentModel.Composition version 4.0.0.0 which comes with .NET 4 or do I have to use Microsoft.Composition?

2. What is the simplest way to integrate MEF with ASP MVC 4 so I can have controllers ctors that accept interfaces and MEF will inject the implementation to them?

Thank you,

Ido.

Aug 22, 2012 at 12:44 PM

Please, can someone post a step by step example.
Thank you.

Sep 13, 2012 at 10:55 AM

Hi,

I've manage to use MEF2 with ASP MVC 4 and .NET Framework 4 and I've describe it in a blog post.

In short I've use MEF 2 Preview 4 which is the version before they change the registration API to work with .NET 4.5 only.

 

Hope it helps,

Ido.

Sep 14, 2012 at 4:06 AM
Hi,
Can you, please, put a complete example.
Thank



From: [email removed]
To: [email removed]
Date: Thu, 13 Sep 2012 03:55:49 -0700
Subject: Re: How to integrate MEF 4.0.0.0 with ASP MVC 4 [MEF:392570]

From: ido_ran
Hi,
I've manage to use MEF2 with ASP MVC 4 and .NET Framework 4 and I've describe it in a blog post.
In short I've use MEF 2 Preview 4 which is the version before they change the registration API to work with .NET 4.5 only.

Hope it helps,
Ido.
Read the full discussion online.
To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)
To start a new discussion for this project, email MEF@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com