Adding an attribute to a property in a partial class
-
Hi, I am using Entity framework in a dynamic data web app with C#. So far I have created a source file with partial declarations of my entity classes on which I have set attributes like ScaffoldTable. I did that in order to not lose this code in case of regeneration of the entity classes.
using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace AdmissionForm { \[ScaffoldTable(true)\] public partial class AdmissionForm { } ... }
I would like to know if there is a way to add attributes to the properties defined in this entity classes from the source file I have added. Regards.
-
Hi, I am using Entity framework in a dynamic data web app with C#. So far I have created a source file with partial declarations of my entity classes on which I have set attributes like ScaffoldTable. I did that in order to not lose this code in case of regeneration of the entity classes.
using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace AdmissionForm { \[ScaffoldTable(true)\] public partial class AdmissionForm { } ... }
I would like to know if there is a way to add attributes to the properties defined in this entity classes from the source file I have added. Regards.
I ran into the same problem here while using .net mvc with LinqToSql classes.. Maybe this can help you.. http://dotnetslackers.com/sql/re-309931_adding_attributes_to_generated_classes.aspx[^]