asp.net mvc - MVC Entity Framework Annotation -


say have following code:

 truck truck = new truck(); truck.id = '12323' return view(truck); 

note entity truck has number of fields associated such color, note, etc.

for note, add annotation maxlength.

how go adding , annotation. know done in class in case, not have class getting truck directly entity framework.

you want make partial class (aka buddy class) entity class , give metadatatype attribute. check out example validation attributes. section labeled using data annotation validators entity framework.

http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validation-with-the-data-annotation-validators-cs


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -