entity framework - EF one to many relation -


i use ef's code first approach. have following 3 classes:

public class inquiry {     public guid id { get; set; }     public string title { get; set; }     public string description { get; set; }     public virtual applicationuser createdby { get; set; }     public virtual contractor contractor { get; set; }     public ilist<applicationuser> inquiryusers { get; set; }     public ilist<inquirycomment> comments { get; set; }     public ilist<hydrotechemail> emails { get; set; }      public inquirystate state { get; set; }     public list<string> attachments { get; set; }      public datetime? timeofcreation { get; set; }     public datetime? timeofmodification { get; set; } }  public class hydrotechemail     {     public guid id { get; set; }     public string subject { get; set; }     public string content { get; set; }     public string fromdisplayname { get; set; }     public string fromaddress { get; set; }     public list<string> todisplayname { get; set; }     public list<string> toaddress { get; set; }     public hydrotechemailstate state { get; set; }     public datetime? receivedtime { get; set; }     public virtual list<hydrotechemailattachment> attachments { get; set; }     public virtual applicationuser applicationuser { get; set; } }  public class applicationuser {     public guid id {get;set;}     public string firstname {get;set;}     public string lastname {get;set;} } 

i thought ef generate intermediate classes relation inquiry -> many emails , inquiry -> many application users. instead created foreign keys in applicationuser , hydrotechemail classes inquiry class. how should create 1 many relations? strange comments created intermediate table named inquirycomments.

entity framework generate intermediate tables many-to-many relationships.

for one-to-many relationships, no intermediate tables created because not necessary.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -