class Entity
{
public int Id { get; set; } // PK
public string Val1 { get; set; }
public string Val2 { get; set; }
}
My Desire/Constraint that I want to add - When inserting a new row to the table, one of the Val columns must be set.
In other words, you can set both OR one of them BUT neither of them is not an option.
This is the same question asked in SQL but in my case, I want to do it in EF Code first approach.
Any Possible Data annotations Attribute that can be used to achieve this ?
Or any special method that I can find in ModelBuilder ?