Many-to-many EF core

Entity core manual
https://docs.microsoft.com/en-us/ef/core/modeling/relationships#many-to-...

-----------
Zero to One

You can do it declaring your foreign key like in the following:

public class Blog
{

public int BlogId { get; set; }
public List Posts { get; set; }

}

public class Post
{
public int PostId { get; set; }
public int? PostId { get; set; }
public virtual Blog Blog { get; set; }
}

M2M

Creating:
1. Create new XY
2. Set XY.X = New X
3. Set XY.Y = New Y
4. Db.SaveChanges()

Deleting:
1. Find and delete XY
2. Db.SaveChanges()

Thanks,

Jeff Bowman

Fairbanks, Alaska

Kategoria: