Код: Выделить всё
public class PrincipalEntity
{
[Key, StringLength(300)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public string Name { get; set; }
// Other properties
public TheKey PrimaryKey { get; set; }
public TheKey SecondaryKey { get; set; }
}
public class TheKey
{
[StringLength(200)]
public string PrincipalEntityName { get; set; } // foreign key
public string Value { get; set; }
// other properties
}
Код: Выделить всё
KeyЯ бы предпочел иметь отдельные свойства PrimaryKey и SecondaryKey в PrincipalEntity, а не в ключах IEnumerable. свойство.
Подробнее здесь: https://stackoverflow.com/questions/781 ... t-entities