I am using Entity Framework and I have the following model class:
public class Test
{
public string Name { get; set; }
public int SiteId { get; set; }
public bool IsPrimary { get; set; }
}
How can I set the column IsPrimary
to be unique in accordance with the SiteId
?
For example I can have multiple records with the IsPrimary
set to false for the same SiteId
, but only one set to true.