简体   繁体   English

实体框架与父母和子女的关系很多

[英]Entity Framework many to parent and child relationship

I have two entities A and B with the following relationship: 我有两个具有以下关系的实体A和B:

  • A has 0 or more B A有0个或更多B
  • B has 1 parent A B有1个父级A
  • B has 1 child A B有1个孩子A

I don't know how to implement this relationship (navigation properties, Fluent API...) 我不知道如何实现这种关系(导航属性,Fluent API ...)

I'm ac# writer, but I thinck you get the picture ? 我是作家,但是我想知道你的照片吗?

class A {
    public List<B> possibleBList {get;set;}
} 

class B {
    public A Parent {get;set;}
    public A Child {get;set;}
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM