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

Why does Azure CloudConfigurationManager.GetSetting return null
where can I download source code for asp.net mvc 5.2.2 version (alone)
How to enable Common.Logging.Log4Net
Object with the same key already exists in ObjectStateManager
Embedded YouTube video is not working on asp.net MVC/Angular app
How to Pass QueryString in MVC WEBAPI routing for the following URL
How to save multiple files to database rather than disk
In MVC can ViewModels access service layer?
Telerik mvc grid, columns.bound to dictionary value. or “dynamic property in model”
RouteLink to an API controller not working in MVC 4 with areas
Access email address in the OAuth ExternalLoginCallback from Facebook v2.4 API in ASP.NET MVC 5 [duplicate]
what is the best solution of accessing action method in another controller asp.mvc?
Using Swashbuckle to Host an Existing Swagger.JSON file
Http Request Timeouts on Azure Web Apps
Autofac + OWIN + Web Api ASP.NET MVC constructor injection not working
.NET MVC controllers and API controllers in the same project

Categories

HOME
actions-on-google
sharepoint-2013
copy
load
android-activity
tcl
watson
visual-studio-2012
application-cache
cross-domain
eloqua
scope
sonata-admin
facebook-opengraph
prerender
w2ui
spring-restdocs
urlrewriter.net
cadvisor
jsgrid
point-cloud-library
google-geocoder
codewarrior
ruamel.yaml
sqlite.swift
complex-networks
machine-language
subtotal
rhel7
qweb
microsoft-translator
tibco-ems
internet-explorer-10
monogame
mediawiki-api
karnaugh-map
http-status-code-500
uservoice
html-lists
fasta
ammonite
unityscript
android-identifiers
liclipse
lcov
gpt
callkit
geneticsharp
gwt-material-design
atmosphere.js
balsamiq
activity-diagram
vlc-android
benerator
okuma
schematiq
asp.net-webpages
ctakes
asp.net-authorization
jedi
pyenchant
heroku-toolbelt
user-registration
nbug
ppl
pencilblue
swift-array
conditional-statements
kue
setattribute
nolio
bessel-functions
publish-actions
dynamic-data-display
zeroclipboard
spread-toolkit
short
data-quality
deepzoom
ituneslibrary
ramdisk
django-endless-pagination
chomsky-hierarchy
xhtml-transitional
python-dateutil
arbtt
hamlc
square-cube
jmdns
squirrelmail
calloc
android-actionbar-compat
datakey
freeglut
livevalidation
combinators
jquery-pagination
arraycopy
scramble
posterous
gedcom
graceful-degradation

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