asp.net mvc - MVC layers and DAL & Data layers -
i've been developing multi-tier mvc application , reviewing i've done far. i've gone , done fair bit of reading again on multi-tiers/layers (there heaps of information out there no real consistency or standard), i'm questioning data layer.
i suspect have implemented incorrectly (in line design) , may have gone off on tangent. here's i've done:
webui
- includes controllers, view models, views
bll
includes service classes contain:
- in-memory manipulation code, e.g. collections...
- data access code, e.g. ef linq entities.
data
- /models folder contains domain classes
- /dal folder contains dbcontext classes
...
stepping back, , re-reviewing, here see, , i'm questioning:
in bll, ef code not correct here. should in data layer. can please confirm?
my data layer (i.e. data project) contains context classes, , domain models. i've read people separate data layer a) dal, , b) models. therefore guess dal layer contain context classes , data (ef) code, , models layer solely contain domain models.this end making have 4 layers in total. maybe excessive or design?
any preference use automapper ef viewmodel mappings? i'm mapping in web layer, suspect may neater in bll. mappings can done in web layer, such selectlistitem drop down lists.
i think using orm (especially in code first approach) makes separate dal project hassle (seriously, da part in orm nothing compared pure ado.net datareader). instead prefer make prj.domain
data persistence. it's dal
+model
layers or yours combined.
the prj.webui
have it's own models (which better named viewmodels) used convenient way treat domain data in views.
from mvc standpoint prj.domain
model, , prj.webui
view , controller.
Comments
Post a Comment