I have an Employee
class:
public class Employee
{
[Key]
public string ID{ get; set; }
[Unique]
public string EmployeeID { get; set; }
}
The ID
becomes the primary key. However, I want the EmployeeID
to be a unique key as well.
Is there any data annotation to make the EmployeeID
field unique?
These are the packages that I am using in my project:
I have tried using [Index(IsUnique=true)]
. But I need to install a new package for this.