views:

708

answers:

4

I've newly started to open my eyes for ASP.Net MVC, but on the site we are currently working on we use DotNetNuke, and I actually like the way you can create new "Modules" and just plug them in to your site with ease (If the module is coded right that is).

Can you achieve this when using the Asp.Net MVC pattern? That you have a co-worker create a new .dll that the designer just can plug into the site without much or any code-behind interaction?

+1  A: 

Why not?

This would be very much similar to the "Provider pattern" used across the entire .net framework. For modules in .net framework, it can dynamically load different Provider without touching the source code, all has to be done in the xml config file.

In practice, you create a ModuleProvider base class, which all modules are going to inherit from this. In the master controller, it loads different ModuleProviders and let them do the rest.

It would be a long passage to explain what the provider pattern and how's the design is to be. Please read the link above and study those provider used in the framework.

xandy
Thank you, I will have a look at it :)
blueblood
True but why not just stick to DNN then, the MVC doesn't provide out the box plug+play module support.
typemismatch
A: 

You will be missing some essential things. Its possible to have reusable code in a separate dll for MVC, but because the usage of controlls (aka modules ) is limited it will be difficult to have a usefull implementation. Oldschool ASP.NET is so much nicer for this kind of applications.

Events

If you have a control you often need it to receive events or send events. Thats only possible in ASP.NET webforms.

Properties

On the container of a control you often have to set public properties. Thats also ASP.NET Webforms.

Did I mention ViewState? I should...

I dont want to take you away from ASP.NET MVC. Its a realy good framework, but I dont see it in a DotNetNuke like application.

Malcolm Frexner
While I agree with you that Webforms is possibly more suited for creating "modules", you need to think a bit more out of the box. Just because events, properties and viewstate are the easiest way for us to conceptualize modules, it doesn't mean it's the only way.
Mr Grieves
+1  A: 

Andrew Nurse (son of DNN's senior developer, Charles Nurse) has begun a basic framework for pluggable DNN-like functionality in ASP.NET MVC, called Maverick, which might be interesting to you.

bdukes
A: 

Check out this blog entry http://blogs.msdn.com/hammett/.

Shows how to embed .aspx and .ascx pages in the DLL by just dropping the DLL in the main apps bin directory, you add the functionality. routing, and navigation. It uses MEF, but you could do it without with a little work.

Matthew