Generating Data Annotations from Generated Classes
问题 I have a linq to sql object or if neccessary Entity Framework object. I want to do MVC 2 Data Annotations for them, but I am endlessly lazy. Is there a way to automatically generate the data annotations a-la [Bind(Include = "Title,Description,EventDate,Address,Country,ContactPhone,Latitude,Longitude")] [MetadataType(typeof(Dinner_Validation))] public partial class Dinner { public bool IsHostedBy(string userName) { return HostedBy.Equals(userName, StringComparison.InvariantCultureIgnoreCase);