Open layris3 opened 4 years ago
on the other hand,if your property doesn't satisfy the pattern above but you wanna regard it as the primaty key.
[Key]
attribute provide a way to set anyone property to be the primary key.
for example,
public class Enrollment
{
[Key]
public int TestID { get; set; }
...
}
by default,EF interprets a property that's named ID or classname ID as a primary key property. For example, classname
ID
patternID pattern