Restrições de chaves exclusivas para várias colunas no Entity Framework
Estou usando o Entity Framework 5.0 Code First;
public class Entity
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string EntityId { get; set;}
public int FirstColumn { get; set;}
public int SecondColumn { get; set;}
}
Eu quero fazer a combinação entreFirstColumn
eSecondColumn
como único.
Exemplo:
Id FirstColumn SecondColumn
1 1 1 = OK
2 2 1 = OK
3 3 3 = OK
5 3 1 = THIS OK
4 3 3 = GRRRRR! HERE ERROR
Existe alguma maneira de fazer isso?