c# - How do i use the AllowHtml attribute with the entity framework -


how go adding [allowhtml] attribute entity framework generated class without attribute being overwritten next time code generated?

i looking allow ckeditor post information mvc4 application using razor without having use [validatereuqest(false)] on content entity class.

you can use [metadatatype] attribute add metadata/attributes classes permanently without having edit original classes.

for class content create new cs file in project , replace empty class with:

[metadatatype(typeof(contentmetadata))] public partial class content {  }  public class contentmetadata {     [allowhtml]     public string contenthtml { get; set; } } 

the partial class name must match class name of entity class exactly, , attribute must match definition of attribute in entity class exactly.

after rebuild, work if put attribute within entity class, added bonus of not being overwritten every time.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -