Asp.net mvc, entity framework, Poco
I have a "small" enterprise application, aspnet mvc 3 + entity framework with POCO entity and repository pattern. I structured the solution in 4 projects:
When the application performs a query on the database, use one of the services provided, the service uses the repository and the small classes, as a result I have some dynamic proxy objects that I would like to convert in my domain entities, before using them in mvc views, but I do not know how. Dovrebber be set as the translator?
This approach is reasonable?
AutoMapper is handy for converting objects from one type to another. It will generally "do the right thing" if all your destination type properties have correspondingly named source type properties, and any nonmatching properties can easily be mapped manually using lambda expressions.
Not sure what the "small classes" being used are, but I assume you will want to use some IOC to be able to inject your repository into the service layer. See more here: http://msdn.microsoft.com/en-us/magazine/dd942838.aspx#id0420033
链接地址: http://www.djcxy.com/p/29154.html上一篇: 带有实体框架的ASP.NET MVC4