问题
I was working on my project using MVC3 & Entity framework and the model of my project was about my entity.emdx only. now i want to convert this project to 3-tiers architecture that will be about: (presentation layer :my old MVC project's views and controllers), (business layer:all operations related to data base), (data access layer: my entity framework(.emdx)), This is what i concluded,, and if i am correct then the model in the MVC project (presentation layer) will be empty ,,,is it possible in MVC that doesn't contain Models?, if my thinking is wrong so, what is the correct thing to do?
回答1:
Yeah its possible to don't have model, the data access layer you created is now act as the Model found in presentation layer(when it was 1 tier)..
The Models now are the entities in the data access, but you Make can your Model even in 3 tier application for some reason like if you want to create ViewModel, see this example about it:
http://www.edandersen.com/2013/05/30/asp-net-mvc-basics-part-2-viewmodel-to-model-mapping-and-editing/
来源:https://stackoverflow.com/questions/33321967/converting-mvc-ef-to-3-tiers-architecture-model