C# Entity Framework - Allowing only one record to have a boolean value of true in a certain column
I have a question that does sound a bit vague.
What is the best way to implement in C# using the Entity Framework a way of ensuring that for a certain column in the table only one record is allowed to be set to the boolean value of true.
This boolean value is displayed via a checkbox on a winform. I also want that when a user checks the value on the form, that record has its value set 开发者_C百科to true and every other record in the db now has that value set as false (so only one record at a time can ever have that particular column as being set to true)
Apologies if this sounds incredibly vague - and just a basic overview of how I need to implement this would be fine.
Many thanks.
精彩评论