ASP.NET MVC project structure
62
92.8
Feb 07, 2010
My team is migrating over from ASP.NET WebForms to ASP.NET MVC. Our Visual Studio solution would exist of the following projects:
- ASP.NET Web App
- Service Layer
- Business Layer
- Data Layer
- Utilities
It is important to note that our App exposes a public API (represented by the Service Layer).
--
Now, with ASP.NET MVC it seems that everything goes, by default, into a single solution, with Model, View, and Controller subfolders.
However, we are considering separating the original layers like we did before.
Like so:
- ASP.NET MVC App (with Controller and Views)
- Service Layer
- Business Layer
- Data Layer
- Utilities
Essentially we are taking the Model out of the MVC App and separating it into Service, Business, and Data Layer.
As mentioned we are relatively new to ASP.NET MVC, so we would like to hear if anyone used a similar approach, or have better suggestions?
50
50
23 days ago
I found the M in the MVC slightly confusing at first. The layers I have chosen are similar to yours, as I wanted the Service Layer on top of the Data and Business Layer.
My initial ideas (prompted by some examples from the books on MVC) made me place the model classes (domain/business) into the Models sub-folder of the ASP.NET MVC project.
Of course, it is possible (as I have seen it was encouraged for the sake of simplicity) to ignore the Models folder and make a dependency on the layers on the lower levels, e.g., Service.