How to make a triple relationship in code first Entity Framework -


how can make triple relationship in ef? i'm planning this:

table foo: (id int text varchar) table coo: (id int text varchar) table boo: (id int text varchar) table foocooboo: (fkfoo int fkcoo int fkboo int) 

i expected using code below achieved:

public class foo {     public int id { get; set; }     public string text { get; set; }      public virtual icollection<boo> boos { get; set; }     public virtual icollection<coo> coos { get; set; } }  public class boo {     public int id { get; set; }     public string text { get; set; }      public virtual icollection<foo> foos { get; set; }     public virtual icollection<coo> coos { get; set; } }  public class coo {     public int id { get; set; }     public string text { get; set; }      public virtual icollection<boo> boos { get; set; }     public virtual icollection<foo> foos { get; set; } } 

but output every icollection ef creates simple many many table. possible? create triple relationship using ef?

may be:

public class foocooboo {     [key, foreignkey("foo")]     public int fooid { get; set; }     [key, foreignkey("coo")]     public int cooid { get; set; }     [key, foreignkey("boo")]     public int booid { get; set; }      public virtual foo { get; set; }     public virtual boo { get; set; }     public virtual coo { get; set; } } 

you have set navigation properties in configuration classes.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -