I am working on an asp mvc3 app that is using .NET 4.
However the model I want to use is in a class library that is using .NET 3.5 and cannot change.
Can I add the .NET 4 data annotations to some properties in my model in the controller programatically to get some easy validation?
Create your own ModelMetadataProvider and this should do want you want
http://www.dotnetcurry.com/ShowArticle.aspx?ID=715
Interesting, I never try that before but could you declare a partial class in your .NET 4 project and use MetadataTypeAttribute to create a sibling class that hold the metadata and decorate it with validation.
Never try that before but similar approach is used in ASP.NET MVC (only for Silverlight). you could see Using System.ComponentModel.DataAnnotations with Entity Framework 4.0