You can use MetadataTypeAttribute to specify the attributes of the generated code in an associated (friendly) class. Thus, you put your attributes in a separate class that will not be executed when the code is regenerated:
[MetadataType(typeof(YourEntityMetadata))]
public partial class YourEntityClass
{
}
public class YourEntityMetadata
{
[AllowHtml]
public string YourPropertyWithHtml { get; set; }
}
Property names in metadata must match the object names of your object.
source
share