Define relationships for hierarchical data in Entity Framework Code First
问题 I have a hierarchical relationship defined for one of my tables where the relationship is stored in a separate join table. The join table also contains information about the type of relationship. The (simplified) schema looks like: Bills ID int IDENTITY(1,1) NOT NULL (PK) Code varchar(5) NOT NULL Number varchar(5) NOT NULL ... BillRelations ID int IDENTITY(1,1) NOT NULL (PK) BillID int NOT NULL RelatedBillID int NOT NULL Relationship int NOT NULL ... I have FK relationships defined on BillID