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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -