I would like some suggestions of using models generated by EF T4 POCO Generator, and leveraging validation attributes in them like normal models do in /Models in MVC project.
Background: We are trying to design a web app, 2 or 3 developers will work on it. It is in a scrum style where we get requirement modifications periodically from our client as we build the web app. The tables, columns and relations may change accordingly.
Our Approach: We want to use EF T4 POCO Generation, as every time when new tables and columns are added to the db, EF T4 can update the POCO models automatically. We want to use these POCO models as the Model layer of the MVC project (in a different Models.dll and include it into the project, instead of sitting in the /Models/ folder of MVC project).
Problem: We want to add attributes to the model classes and properties. However, EF T4 will override the model classes and we can't (and don't think we are supposed to) add these attributes into those models. We don't know what is the correct approach.
I can only think of making attributes in wrappers ViewModels in the MVC project. They wrap around all the necessary models from the Models.dll done by EF T4. Then put attributes in front of them. But it looks ugly to me defeating the DRY principle. How would you do it? Thanks ahead for the ideas!
--- EDIT --- I did find a cool trick here assisting my wrapper idea. However, I didn't mention it because I want to be open to see different suggestions and compare them :)