First, I am new to MVC.
I have a Project table which has ProjectID, ProjectNumber, and ProjectDescription fields. The ProjectId is an entityKey of type int, the ProjectNumber needs to be a unique constraint.
How do I do this in entity framework 6.1.3?
in my Project class I have
public int ProjectID { get; set; }
[Index(IsUnique = true)]
[StringLength(200)]
public string ProjectNumber { get; set; }
public string ProjectDescription { get; set; }
when I generate database from model, the field is not set as unique in the database.
what am I doing wrong?