Bulk Update in Entity Framework Core

.net c# entity-framework entity-framework-core

Accepted Answer

If TimeEntry has a connection toInvoice You can possibly do something like this (check the navigation properties):

var timeEntries = context.TimeEntries.Where(t => timeEntryIds.Contains(te.Id)).ToArray();

foreach(var timeEntry in timeEntries)
    invoice.TimeEntries.Add(timeEntry);

context.Invoices.Add(invoice);

//save the entire context and takes care of the ids
context.SaveChanges();
4
4/20/2017 11:49:34 PM

Expert Answer

ZZZ_tmp
13
1/14/2020 1:21:23 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow