We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi
I got this "simple" model
public class Container { public int Id { get; set; } public string Name { get; set; } public List<Item> Items { get; set; } = new List<Item>(); } public class Item { public int Id { get; set; } public string Name { get; set; } public List<Item> LinkedItems { get; set; } = new List<Item>(); }
In order to get the Item n-m Item relation inside an extra table I put the following inside OnModelCreating method
Item
OnModelCreating
modelBuilder.Entity<Item>() .HasMany(item => item.LinkedItems) .WithMany() .Map(configuration => { configuration .MapLeftKey("From_ItemId") .MapRightKey("To_ItemId") .ToTable("ItemLinks"); });
So let's assume
Container#1 { Items={ Item#1, Item#2, Item#3 } }
Container#2 { Items={ Item#4{ LinkedItems={ Item#1, Item#2 } } }
Container
Item#4
Item#1
Item#2
var newContainer = new Container { Name = "new", Items = { new Item {Id = 4, Name = "#4", LinkedItems = {new Item {Id = 1, Name = "#1"} }} } };
My question is: *Is their a single UpdateGraph() call to
UpdateGraph()
Container#2
I finally got it running but I need 2 calls:
_context.UpdateGraph(newContainer, map => map.AssociatedCollection(c => c.Items) ); _context.UpdateGraph(item4, map => map.AssociatedCollection(i => i.LinkedItems) ); _context.SaveChanges();
But this solution doesn't help very much since I have to run the second UpdateGraph on each child!
UpdateGraph
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi
I got this "simple" model
In order to get the
Item
n-mItem
relation inside an extra table I put the following insideOnModelCreating
methodSo let's assume
Container#1 { Items={ Item#1, Item#2, Item#3 } }
Container#2 { Items={ Item#4{ LinkedItems={ Item#1, Item#2 } } }
Container
Item#4
inside it.Item#1
, 1xDelete referenceItem#2
)My question is: *Is their a single
UpdateGraph()
call toItem#4
fromContainer#2
ANDItem#4
->Item#2
I finally got it running but I need 2 calls:
But this solution doesn't help very much since I have to run the second
UpdateGraph
on each child!The text was updated successfully, but these errors were encountered: