Insert operation with many-to-many relationship using EF

后端 未结 3 1275
醉梦人生
醉梦人生 2020-12-29 11:42

I\'ve two model classes:

public class Candidate
{
  public int Id { get; set; }
  public string Name { get; set; }
  public ICollection Jobs { get         


        
3条回答
  •  再見小時候
    2020-12-29 12:13

    A very simple solution is to create a VIEW of the xref table exactly as the table (view_tablename_raw). Then update that view in EF as an entity without foreign keys. From their use context.view_tablename_raw.Add(...) and it will work seamlessly.

提交回复
热议问题