Last post Mar 18, 2012 12:04 AM by EnenDaveyBoy
Mar 16, 2012 10:01 PM|EnenDaveyBoy|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 12:01 AM|thinkrajesh|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 17, 2012 09:29 PM|EnenDaveyBoy|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 12:04 AM|EnenDaveyBoy|LINK
its ok sorted