Domain Models and Data Annotation?

I have defined my domain models in an assembly(Core) which is not depend upon anything. Now, my MVC application references these classes. I want to Data Annotation validation should happen in MVC controller but I am unable to add the Data Annotation attributes in my domain model project. How to fix this issue? Is there any dynamic way to add these Annotation in to my domain model classes.

Upvotes: 0

Views: 263

Answers (1)

free4ride
free4ride

Reputation: 1643

Don't use domain models in your views. Create dedicated view models with necessary data otherwise you will end up with a headache one day :)

Upvotes: 2

Related Questions