c# - N-tier Application Data Model -
i develop ntier mvc application .net. have 4 layer. ui layer, servicelayer, business layer , dal. (i use ef5 dal)
i add project entities. projects structure this.
myproject.dal myproject.interfaces myproject.entities myproject.mvcwebui myproject.bll i wonder that, need type class model method's return. it's not neccessary store in database. shortly it's not entity.
for example have product entity. need model it's store product's status , count. how should locate it?
public enum prodreviewresult { accepted = 1, declined = 2, banned = 4 } //myproject.dal //i need here return typed model public list<object> getprodreviewstatusbyprodgroup(int userid, int prodgroupid) { var query = p in _db.products join pg in _db.prodgroups on p.prodgroupid equals pg.prodgroupid pg.userid == userid && p.userid == userid group p p g select new {prodviewresult = g.key, prodcount = g.count()}; var reviewstatus = new list<object>(); foreach (var result in query) { reviewstatus.add(new {result.prodviewresult, result.prodcount}); } return reviewstatus; } //this class model products group prodreviewstatus. //how should locate in project. public prodreviewcount() { public prodreviewstatus prodreviewstatus{get;set;} public int count{get;set;} }
i don't have intimate knowledge of application, seems excessive me. service layer, business layer , dal pretty same thing. they're part of domain. unless have reason not discussed here why need 3 distinct projects, i'd should trying merge of appropriate.
that said, you're talking dto (data transfer object). such, based on current structure, i'd should go dal project.
Comments
Post a Comment