c# - Entity Framework Type configuration integer range -
i have assigned new project , have decided follow this architecture . have class this
public class course {     [databasegenerated(databasegeneratedoption.none)]     [display(name = "number")]     public int courseid { get; set; }      [stringlength(50, minimumlength = 3)]     public string title { get; set; }      [range(0, 5)]     public int credits { get; set; }      [display(name = "department")]     public int departmentid { get; set; }      public virtual department department { get; set; }     public virtual icollection<enrollment> enrollments { get; set; }     public virtual icollection<instructor> instructors { get; set; } }   now want take out dataannotations , put them in separate class using entitytypeconfiguration configuration classes, this
    public class courseconfigurations : entitytypeconfiguration<model.course> {     public courseconfigurations()     {         totable("courses");         property(d => d.id).isrequired();         property(d => d.title).hasmaxlength(50);         property(d => d.credits);     } }   now how put int , string range in configuration classes ? possible here or have in modelview ? how can differentiate validation ?
any appreciated ,i new mvc , these patterns bear me please :).
 
 
Comments
Post a Comment