Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to structure my ASP.NET MVC 2 project with Areas sensibly

I want to structure my ASP.NET MVC 2 web application sensibly using Areas. The application consists of the two main parts Website which is the default part and Dashboard which administrates the site using a CMS. (Probably, more Areas will follow later on.)

How do I structure my project best? Should I ...

  1. create the Area Dashboard and put the stuff belonging to the Website part into the main application folder or should I
  2. create both Areas Website and Dashboard?

Additionally, where should I place my Entity Data Model and the corresponding Repository classes that have to be accessed by both Areas?

like image 993
Marius Schulz Avatar asked Oct 14 '22 01:10

Marius Schulz


1 Answers

I would go with option 1. Then your urls would look like this (if you use the default routing):

Website: http://mysite/ Dashboard: http://mysite/dashboard

If you change your mind later on, it's not too difficult to move your website into an area.

As for your "model", I wouldn't bother with the Models folders created by default for an MVC project. I would probably put this in its own project, give it a sensible namespace (mysite.domain or mysite.model) and reference it from the mvc app.

like image 131
Peter Avatar answered Oct 20 '22 01:10

Peter