c# - EF6 Many-to-Many on Non-Key Column -


i having trouble connecting many-to-many relationship in ef6 using code first, creating pass-through association beyond that.

there 3 classes: person, tag, , passing.

each person has optional bib.

each tag has optional bib, not unique.

each passing has required tagid.

i want access passings linked person getting tags same bib, getting passings associated each of tags.

i have tried using dbmodelbuilder in dbcontext class can't work properly, , ef6 seems try generate intermediate table anyways, seems unnecessary.

public class person {     [key]     public int personid { get; set; }     ...     public string bib { get; set; }     public virtual icollection<tag> tags { get; set; }     public virtual icollection<passing> passings }  public class tag {     [key]     public string tagid { get; set; }     public string bib { get; set; }     public virtual icollection<passing> passings { get; set; }     public virtual person person { get; set; } }  public class passing {     [key]     public int passingid { get; set; }     ...     public string tagid { get; set; }     public virtual tag tag { get; set; } } 

it necessary, when have * * multiplicity table, automaticly creates table links these, elseway cannot put infinite , variable number of foraign key in 1 of table


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -