Parts folders with ASP.net MVC areas

Feb 3, 2012 at 5:59 PM

I have seen in the article below the with the ASP.net MVC functionality you just need a Parts folder to set up exports. I aso see in the article that you can assemblies and automatically import using 'Parts' namespace. Based on this, will it be posible to have a 'Parts' folder per MVC Area and have auto registration work?

http://blogs.msdn.com/b/bclteam/archive/2011/11/11/using-mef-2-with-asp-net-mvc-3.aspx

Coordinator
Feb 3, 2012 at 6:06 PM

I might be wrong on this and Nick can correct me if I am, but I believe that we look for a parts folder in the bin directory. I am not sure what you mean by different MVC areas ?

Hth

-alok

From: leriksen71 [email removed]
Sent: Friday, February 03, 2012 11:00 AM
To: Alok Shriram
Subject: Parts folders with ASP.net MVC areas [MEF:291416]

From: leriksen71

I have seen in the article below the with the ASP.net MVC functionality you just need a Parts folder to set up exports. I aso see in the article that you can assemblies and automatically import using 'Parts' namespace. Based on this, will it be posible to have a 'Parts' folder per MVC Area and have auto registration work?

http://blogs.msdn.com/b/bclteam/archive/2011/11/11/using-mef-2-with-asp-net-mvc-3.aspx

Feb 3, 2012 at 6:06 PM

Hi – so long as the Parts folders are either in the main application assembly, or are added using CompositionProvider.AddAssembly(), the parts will be correctly discovered.

Cheers,

Nick

From: leriksen71 [email removed]
Sent: Friday, February 03, 2012 11:00 AM
To: Nicholas Blumhardt
Subject: Parts folders with ASP.net MVC areas [MEF:291416]

From: leriksen71

I have seen in the article below the with the ASP.net MVC functionality you just need a Parts folder to set up exports. I aso see in the article that you can assemblies and automatically import using 'Parts' namespace. Based on this, will it be posible to have a 'Parts' folder per MVC Area and have auto registration work?

http://blogs.msdn.com/b/bclteam/archive/2011/11/11/using-mef-2-with-asp-net-mvc-3.aspx

Feb 3, 2012 at 6:11 PM

That's awesome!

Feb 3, 2012 at 6:13 PM

Thanks Alok. No, we don’t use the layout of the Bin folder when looking for parts. The Parts “folder” is a namespace-driven rule; the actual folder layout does not matter so long as the parts have “.Parts” somewhere in their namespace.

Cheers,
Nick

From: alokshriram [email removed]
Sent: Friday, February 03, 2012 11:06 AM
To: Nicholas Blumhardt
Subject: Re: Parts folders with ASP.net MVC areas [MEF:291416]

From: alokshriram

I might be wrong on this and Nick can correct me if I am, but I believe that we look for a parts folder in the bin directory. I am not sure what you mean by different MVC areas ?

Hth

-alok

From: leriksen71 [email removed]
Sent: Friday, February 03, 2012 11:00 AM
To: Alok Shriram
Subject: Parts folders with ASP.net MVC areas [MEF:291416]

From: leriksen71

I have seen in the article below the with the ASP.net MVC functionality you just need a Parts folder to set up exports. I aso see in the article that you can assemblies and automatically import using 'Parts' namespace. Based on this, will it be posible to have a 'Parts' folder per MVC Area and have auto registration work?

http://blogs.msdn.com/b/bclteam/archive/2011/11/11/using-mef-2-with-asp-net-mvc-3.aspx

Feb 3, 2012 at 10:52 PM

Just had time to try it out with an MVC 3 app, and it works as I hoped it would. 

This is pretty awesome! :) Love the zero configuration!

 

Feb 8, 2012 at 2:36 PM

So can you provide a sample that shows how to use Areas as Parts?

Feb 8, 2012 at 10:44 PM

Not really necessary. If you are in Visual C# and you set up any 'Parts' folder, it will create a namespace name 'Parts' for any classs you put in there. MEF will automatically bind it to itself, and if you want to export as an interface or base type just use the 'Exports' attribute.

All you have to do is just copy the codeplex dll's into place, set up the Parts folder and your ready.

 

Feb 9, 2012 at 12:32 AM

I agree this is great :-), but lets go one step further, what if I want to have an Area in a separate assembly. In this case I could simply drop the Area assembly in the bin folder and my application will discover and extend functionality. Wasn't this supposed to be the primary goal of Managed Extensibility Framework?

I hope one of the team members responds to this. Thanks.