Where should data validation happen?

Topics: Web Guidance v-Next (not WCSF)
Coordinator
Dec 21, 2009 at 6:30 PM

Currently, we have Domain Models and View Models in the RI's codebase.  In a few spots ( like the UserProfile and ProfileViewModel) we have duplicate DataAnnotation attributes, performing the same validation.  We like having validation on the view models (allowing us to easily leverage the platform to get client-side validation to work).  However, we do not like the duplication, and we have differing ideas in the team room on how to manage it. 

So, where should the validation logic (or data annotations) live? On the Domain Model entities, on the View Model entities, both, or neither?  If both, how do you handle duplication?  How do you all manage this problem in your applications?

Thanks,
Mike