I have a 4-layer web application programmed in C # .... Net 4.0:
- User interface level
- Business level
- Data access level
- Entity level
My data layer contains edmx The level of my objects contains my POCO objects (generated using the t4 script), and this level is referenced in all other layers.
When creating an MVC form to create a new client, for example .... I already have a client class with fields for first name, last name, etc. at the level of my entities, but this automatically generated POCO class does not have data annotations for verification ... IE [Required], etc. To submit a form
My solution right now is to create new model classes that pretty much match my poco classes, but also contain these additional annotations for validation.
What I want to know is an easy way to use certain POCO objects in the MVC model (at the user interface level) without having to rewrite the class ... and also without changing the t4 that generates these POCO classes (since I'm not up to speed t4).
I saw this from another post in stackoverflow http://automapper.codeplex.com/ ... not sure if this will do this or be the best solution.
source
share