Hi,
I have written a function in the <MyApplication>RepositoryBase class that takes List of entity (List<Product> NewProducts) as input parameter. And following is the code of the function. Essentially, I am trying to bulkinsert products in the database. But in the last line of the code (i.e. Context.BulkSaveChanges();), it throws the following error: Exception: KeyNotFoundException Message: The given key was not present in the dictionary.
Context.ChangeTracker.AutoDetectChangesEnabled = false;
Context.Set<Product>().AddRange(NewProducts);
Context.ChangeTracker.DetectChanges();
Context.BulkSaveChanges();
Any idea what could be the reason and how to resolve this?
Regards, Mahendra
4 Answer(s)
-
0
Hi,
Please don't bother on my above issue. It has been fixed now...
-
0
Thanks for letting us know!
In case anyone has the same issue, upgrade Z.EntityFramework.Extensions.EFCore to v2.0.8. Resolved here: https://github.com/zzzprojects/EntityFramework-Extensions/issues/63
-
0
Hi I would also like to implement Z.EntityFramework.Extensions.EFCore
Can you explain how to use it. I have installed the nuget in the Application section
How do I user it?
I would like to update a bool to true on the following:
var timesheets = _timesheetsDetailRepository.GetAll() .Where(e => e.TimesheetId == input.Id);
-
0
var context = _timesheetsDetailRepository.GetDbContext(); context.BulkUpdate(timesheets);
https://entityframework-extensions.net/bulk-update