tags:

views:

310

answers:

3

We will be developing a very large vertical market web application, and are leaning toward the MVC approach.

It will have 1 Master Page common to all views in the application. The master will provide a navigation/search framework for the entire application that will allow users to search and select entities and then navigate to a function to perform.

The database model will have 700 to 1000 tables. The application will have hundreds of controllers.

Controllers and their views could be grouped together into one of the many (20-50) subsystems in the application. (We are looking at an areas approach to aide in organization).

We want to be able to deliver enhancements/updates in small functional pieces. These might me a new function, a bug fix, customer dependent functionality, or optional modules separately purchased by the enduser.

We spent too many years developing/supporting and delivering one large windows vb app exe. We would like to take another approach.

Management does not want to deliver one large application. They want to be able to deliver small incremental pieces when necessary.

We may want to create a deliverable that contains one controller, and only a couple views, and a portion of the model.

To deliver it, we want to copy a dll to a bin folder, and create a View folder and copy in the new view(s). As simple as possible!

I have spent many days researching this and haven't come up with a clear path to proceed. (Every tutorial and article I found assumed a single project.)

How do we structure the application to accomplish this?

How do we break up the application into separate projects/assemblies to do this?

Can you build a base project that contains the Master Page, authentication, and Global routing, and then reference this in each of the potentially hundreds of other projects for each of the modules?

In development, does each sub-project need to contain the entire base project, or just the shared views folder, Global routing, and web.config and a reference to the base project dll?

Any detail documents explaining this approach?

Any development/Testing issues?

Thanks for all input, we have to get this going soon.

Update:

Followed the example here link text

It is a great starting point!

+1  A: 

I think this is exactly the case where DLR would help. Your Controllers and Views can be stored as scripts in the database. It will be very easy to deliver your application as a set of "small functional pieces". You could start from reading Haacked - Scripting ASP.NET MVC Views Stored In The Database

eu-ge-ne
Thanks. This may be something to look at, but I initially am looking at how to break the project up into dll's.
SY
A: 

Google for MVC with MEF. There is an example by one of the MEF team that will suit your needs exactly.

Burt
Interesting... I'll have to check that out. The URL is -- http://blogs.msdn.com/hammett/archive/2009/04/23/mef-and-asp-net-mvc-sample.aspx
GuyIncognito
Thats the one. I was on the iPhone or I would have googled it for you.
Burt
This sounds too good to be true. I will definitely look at this. Is this really meant to handle up to 500 plugins? Thanks!
SY
I would imagine it can handle as many plugins as the computers memory can handle.
Burt
I was able to put together concept app with MEF. It works very well. Able to put controller/views in separate assembly (plugin) and reference model in Base App, model embedded in the same assembly, or model in a separate assembly.Thanks for the input!
SY
Glad I could help...
Burt
+1  A: 

Absolutely, break the project up into sub-projects / modules containing your controllers. You can use an IoC container like Unity, Spring.Net, or Castle Windsor to locate your appropriate controllers in the child projects.

Implement your own IControllerFactory to do the Controller lookups in the IoC container based on the controller name passed to it. You're looking to put in place an IControllerFactory.CreateController method that looks something like:

public IController CreateController(RequestContext requestContext, string controllerName) 
{
  return (IController)IoCContainer.GetObjectByName(controllerName);
}

Then you should be able to simply modify your IoC configuration file to define your new controllers as they are deployed.

Jeff Fritz
Great. (I thought I was a bit overwhelmed with the whole MVC concept, now as I dig deeper...) More homework to do, but thanks for the input.
SY
No.. this isn't something to be overwhelmed by. Just about everything in MVC is replaceable and extensible. If you are looking to build an extensive MVC website, you are going to need to dig into the corners of the framework to add your extensibility points.
Jeff Fritz
+1 This is obviously the way to go for our overall application. The initial idea was a dynamic approach to adding controllers which MEF does. We will be evaluating IoC containers for the core application, and the many other benefits it provides beyond MEF. Thanks for the input!
SY