Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 18, 2012 04:04 AM by EnenDaveyBoy
Mar 17, 2012 02:01 AM|LINK
I have a solution which has a core, data, and service project, plus a UI MVC project, I have all by database code first models in the data.
Am i right to have two folders in core,one for a copy of the entity models in data, but with extra validation and similar methods
one for viewmodels, which will contain models which would have multiple core models?
if not where do I put them?
Mar 17, 2012 04:01 AM|LINK
Your viewmodels should be in the "Models" folder of your MVC project. Essentially with EF code first your c# classes may directly become your presentation model as well, if there's a one to one mapping.
But if you need to create a specific model which is composed of other data model, then "Models" should be a place to go.
Your EF model will definitely be in a separate DB model assembly so that those changes could be kept separately.
The other thing is you can also put all your view models in a separate assembly for granular abstractions of presentation model if required.
Mar 18, 2012 01:29 AM|LINK
Thanks, but if I send a view model to the view, what I am doing at the moment is putting them in a view model and sending them to the view is this incorrect?
Mar 18, 2012 04:04 AM|LINK
its ok sorted