How to implement areas in ASP.NET MVC 1.0 to be most compatible with ASP.NET MVC 2.0

Until yesterday's release of the ASP.NET MVC preview, I desperately needed a function, such as a "scope", but I don’t know how it was called so that it could be found.

The preview describes the "areas" as:

Areas - provide a way to divide a large web application into several projects, each of which can be developed in relative isolation. This helps developers manage the complexity of creating a great way to group related controllers and views.

In my case, I create an online store as part of the application. I would like to share everything under /store / with controllers like /store/products/ and /store/checkout .

The ASP.NET 2.0 scopes feature seems to be exactly what I want, but I cannot justify switching to it for a production application (although this is very tempting!).

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

It would be really interesting if anyone used any approach - or perhaps someone who is familiar with both.

I would like to move the store logic to a separate 'area' as soon as possible, but I can’t decide whether to try to use the Phil November solution or just implement it with a preview? I assume that even some of my code will need to be changed - the RESTful URLs that I would create would not need to be changed, so I tend to try using the "grouping controller" method. Has anyone tried it too?

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

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

+6
asp.net-mvc
source share
3 answers

I use the proton proton Phil earlier (the one you contacted) in MVC 1.0 in the project I'm working on. It seems to work similarly to the areas of MVC 2.0, and it still works for me. There is a setting that needs to be done to get a general idea .

Like you, I cannot justify using previews for production code ... I hope that it will not work too much for refactoring later when 2.0 is released.

+1
source share

Because Asp.net MVC 2.0 is still present in the phrase β€œPreview 1,” it does not have a live license. Therefore, you cannot use it in a real application. The easiest way to solve this problem is to create a custom factory controller and a custom controller, for example, in this article .

In addition, you should focus on custom routing for mesh applications. Check it out .

Read this for more information on Asp.net MVC 2

PS. I think like you. The controller / presentation structure is not enough for a large-scale or medium-term web application.

+1
source share

You might want to check out the follow-up article that 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.

0
source share

All Articles