views:

236

answers:

3

Until the preview release yesterday of ASP.NET MVC I had been desperately needing a feature like 'areas' but not known what it was called to be able to find it.

The preview release describes 'areas' as :

Areas - provide a means of dividing a large web application into multiple projects, each of which can be developed in relative isolation. This helps developers manage the complexity of building a large application by providing a way to group related controllers and views.

In my case I am building an online store as one part of the application. I'd like to partition everything under /store/ with controllers like /store/products/ and /store/checkout.

The ASP.NET 2.0 areas feature seems to be exactly what I want, but I cant yet justify moving to it for a production application (although its very tempting!).

I noticed that Phil had an article about 'grouping controllers' way back in November - actually titled 'Areas in ASP.NET MVC'

Would really be interested if anybody has used either approach - or prefarably someone familiar with both.

I'd like to move my store logic into a separate 'area' as soon as possible - but can't decide whether to try to use Phil's November solution or just risk implementing it with the preview release? I assume that even some of my code would need to change - the RESTful URLS I would have created would not need to change so I'm leaning towards trying the 'grouping controllers' method for now. Anybody tried either?

http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx

MSDN areas documentation: http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx

+1  A: 

Because Asp.net MVC 2.0 is still in Preview 1 phrase and it doesn't has a go live license. So, you can't use it in real-world application. The easiest way to solve this problem is creating custom controller factory & custom controller like this article.

Moreover, you must focus on custom routing for crating area-like application. Please look at this.

Please read this for more info about Asp.net MVC 2

PS. I think like you. The controller/view structure isn't enough for large-scale or middle-scale web application.

Soul_Master
i just dont want to end up having to re-do everything later
Simon_Weaver
Soul_Master
By the way, it still has a lot of bug in Area feature. Can you wait untill preview is released? I think it almost complete in preview 2 phrase.
Soul_Master
A: 

You may want to check out the follow up article he wrote, http://haacked.com/archive/2009/07/31/single-project-areas.aspx. This may give you some insight to help make your decision easier.

Dale Ragan
+1  A: 

I'm using Phil's earlier areas prototype (the one you linked to) in MVC 1.0 in the project I'm currently working on. It seems to work similar to MVC 2.0 areas, and it's working fine so far for me. There is a tweak you need to make to get generic views working though.

Like you, I can't justify using the preview release for production code... hopefully it won't be too much work to refactor later when 2.0 is released.

Luke Sampson