This can be done using the MetadataType attribute for the classes generated by Ef. EF generates partial classes. In this way, they can be extended and attributes added. Then another “class of friends” can be written, which may have a party decoration. for example
[MetadataType(typeof(EFGeneratedClass_MetaData))] public partial class EFGeneratedClass { } public partial class EFGeneratedClass_MetaData { [Required] [Display(Name="Member1 Display")] public string Member1 {get; set;} }
amit_g
source share