Reputation: 11597
I am writing an application that makes use of entity framework.
One of my tables is called Individuals
, it needs a column Sex
which should only allow the values Male
, Female
or Unknown
.
How should this be implemented with entity framework? Of course, I can just restrict the input that the user is allowed to enter, but I'd like there to be a constraint on the database also.
Upvotes: 0
Views: 159
Reputation: 245389
The column should be of type int and then mapped to a field that is an Enum that has the values Unknown, Male, Female.
Upvotes: 1