简体   繁体   中英

Entity Framework many to parent and child relationship

I have two entities A and B with the following relationship:

  • A has 0 or more B
  • B has 1 parent A
  • B has 1 child A

I don't know how to implement this relationship (navigation properties, 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;}
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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