Database build error:
One or more validation errors were detected during model generation:
Key_Authorities_Source_Key_Authorities_Target: : The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical.
Key Class:
[Table("Keys")] public class Key { [Key, Column(Order = 0)] public int Id { get; set; } [Key, Column(Order = 1)] public int OwnedByFId { get; set; } [Key, Column(Order = 2)] public int OwnedByUId { get; set; } public string Name { get; set; } public string Description { get; set; } [ForeignKey("Id"), Column(Order = 1)] public virtual ICollection Authorities { get; set; } }
Key Authorities Class:
[Table("Key_Auths")] public class KeyAuthorities { [Key, Column(Order = 0)] public int Id { get; set; } [Key, Column(Order = 1)] public int KeyId { get; set; } public int DoorId { get; set; } public int VehicleId { get; set; } public int GateId { get; set; } }
Problem:
I already read several other Stack Overflow Questions regarding this problem and tried a bunch of stuff but I still can't figure out why this doesn't let me set this foreign keys.
I would really appreciate some help :c