viewmodels go in the presentation layer (MVC). We usually put them in a subfolder called ViewModels.
EF + mapping (in case of Code First) goes in the data access layer. The Models we pass through all the layers are put in a Common.Model class library. They're getting mapped to viewmodels in the presentation layer (not in the controller actions themselves).
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Common class library which gets referenced in the above to pass on data back and forth
I've also seen other architectures where between every layer there's a separate model layer and conversion steps. Consisting of 50+ projects in the solution. Most of the time that's just overkill and the above goes pretty well for small to middle class (enterprise)
applications. If you go for a super large application with lots of integrations (different layer/class library) you might want to tweak/stretch the architecture.
Simply find what works well for you, don't overdo it and be consistent.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Ajeesh Ch
Member
2 Points
4 Posts
Architecture Doubt in MVC And EF
Dec 12, 2012 06:05 PM|LINK
Hi all i am new to project architecture so what i want to know is in mvc with EF i am planing to split the layers as
1) mvc web application
2) viewmodel project
3) bussiness layaer
4) Data Access layer
my question is in which project i will add my Ef class or else i need to create a separate project for the EF.
XIII
All-Star
182712 Points
23465 Posts
ASPInsiders
Moderator
MVP
Re: Architecture Doubt in MVC And EF
Dec 12, 2012 07:54 PM|LINK
Hi,
viewmodels go in the presentation layer (MVC). We usually put them in a subfolder called ViewModels.
EF + mapping (in case of Code First) goes in the data access layer. The Models we pass through all the layers are put in a Common.Model class library. They're getting mapped to viewmodels in the presentation layer (not in the controller actions themselves).
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Ajeesh Ch
Member
2 Points
4 Posts
Re: Architecture Doubt in MVC And EF
Dec 12, 2012 09:35 PM|LINK
Hi thanks but still i am not clear about how to approch in this case.
Can u please reorder my solution in correct way.once again thanks for your replay
XIII
All-Star
182712 Points
23465 Posts
ASPInsiders
Moderator
MVP
Re: Architecture Doubt in MVC And EF
Dec 13, 2012 07:25 AM|LINK
Hi,
I've also seen other architectures where between every layer there's a separate model layer and conversion steps. Consisting of 50+ projects in the solution. Most of the time that's just overkill and the above goes pretty well for small to middle class (enterprise) applications. If you go for a super large application with lots of integrations (different layer/class library) you might want to tweak/stretch the architecture.
Simply find what works well for you, don't overdo it and be consistent.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!