asp.net-mvc


Layering an ASP.NET MVC Web Application


When I develop a WinForms or WebForms app, I create a solution and add multiple projects. The BOL project is a class library for business objects, there's a SQL and a DAL project for ADO.NET related stuff, I have a Utilities project which contains classes for stuff like validation and whatnot. Now the presentation layer which I usually call the GUI contains the forms. The forms work directly with the BOL, which connects to the SQL which connects to the DAL, etc...
I'm sure you all know this already so here's where I get confused. In working with MVC, projects I see all contain this type of functionality but are all in one project, just separated into folders. I looked at the Nerd Dinner application and even that is all in the one project. The end result is a single DLL to handle it all. Is this a good idea, or do you guys separate the pieces into different projects? Usually one DLL has to go through another DLL before it can reach the data access DLL type of thing. Maybe I'm just confused on the whole concept.
You can always seperate this logical layers into seperate physical layers (projects). You can create a seperate project for your Entities, one for your Data Access code etc..
Here is the structure i did for one of my receny project
1) UI : The standard MVC Project with UI related stuff. Controllers and Views and Relevant CSS stuff & Scripts.
2) Entities : The class library Project. My Business entities are here. These are just POCO's which represent my domain modal ( I use this for the CodeFirst Database generation).
3) Data Access : The class library Project. I have my Data Access code here. Repositary, Interfaces and my DBContext class as well.
4) Test : My Unit Tests are in this project.
UI Project has a reference to my Entities and My Data Access Project.
Data Access Project has a reference to my Entities because my Repositary method returns objects.
I have few ViewModel classes also inside my UI project ViewModels folder. I use this for some screens where i have to show data from multiple domain objects. I have a mapping/service class which maps the domain object to view model object. If your project is bifg, you may keep this as a serperate project under the same solution.
The solution looks like this. (This is an open source project i am working on)

Related Links

Subdomains in Asp.Net MVC Application
How to show two strings in ASP.NetDropDownList SelectList dataTextField?
Securing the Forms Authentication Cookie when offloading SSL
Asp.Net MVC - FluentValidation
How to handle callbacks in asp.net?
Authorization in a multi-homed environment
MVC Views from Database
How can I access the HttpServerUtility instance in ASP.NET MVC controller?
Can you map the results of a manual SQL query to objects in Entity Framework?
Any way to detect classic and integrated application pool in code?
ASP.Net MVC 2 authentication (login) best practices
overload ActionResult
Razor: Creating a view from a nested layout doesn't auto create the sections
Saving entities with foreign key in ASP.NET MVC
“HTTP Error 404.3 - Not Found” force download of .step file in IIS7.5
MVC3 EF4 POCO Repository/UnitOfWork Connection Error

Categories

HOME
matlab
wix
lua
coffeescript
android-sqlite
robotframework
graylog2
apacheds
bolt-cms
anylogic
geolocation
bootstrap-selectpicker
antlr
mvvm-light
ibm-midrange
ceph
clion
sql-server-express
apex
qualtrics
apache-kafka-streams
amplitude
nsmutableattributedstring
google-finance
multiprocessing
windows-applications
ormlite-servicestack
django-autocomplete-light
iteration
code-signing
toolbar
android-imageview
python-behave
gcp
directx-12
breakpoint-sass
stomp
apex-code
stackexchange.exceptional
blockui
haxm
querydsl
gradient-descent
api-doc
angular-xeditable
runge-kutta
runc
csr
internet-explorer-10
worldpay
compass-lucene
polymer-cli
qmake
syncfusion
mediawiki-api
keyboard-maestro
federation
gcc4.8
unityscript
python-module
facebook-canvas
email-notifications
geneticsharp
menustrip
vsvim
pakyow
screen-capture
win32com
filenet-content-engine
wgs84
coldfusion-10
interpreted-language
linq2db
polygons
android-listfragment
voting
telescope
sslv3
fastparse
typesafe-activator
cpp-netlib
zeroclipboard
twill
hebrew
onejar
llblgenpro
glulookat
micro-orm
hresult
sparc
argumentexception
northwind
cassette
datakey
asp.net-session
ribbon-control
maven-bundle-plugin
time-limiting
hpple
bubble-popup
blackberry-os-v5
replay
staging
indextank
sloc
drwatson
crc-cards

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App