-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
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
Reusing DB context issue with large collections #438
Comments
Hello, |
Great to hear! I eagerly removed the dbcontext instance from the thread lock as I assumed the node instance was threadsafe, and the dbcontext instance was local to the batch anyway. My thinking that parallel queries are supported, just not within a single dbcontext. Similar to how the .net request pipeline doesn't enforce singleton access to a dbcontext. Thanks for picking this up. I'm enjoying learning about your framework. |
Operators are meant to work in parallel, (that's the purpose). But EF core raises an exception when a query is already being run on the same Just as an extra information, in the current implementation, the fact the Of course, if you issue a different About proper release of entities, I will make a quick win: execute a |
a new version 2.1.6-beta is available. I didn't test it too well to speak franckly. You can give it a try. I should work with IDbContextFactory out of the box. If you want to specify the type of the DbContext, you must call |
Hi all,
I've been using the
EfCoreSave
operator withSaveMode.EntityFrameworkCore
option enabled as I'm planning to write my data to Postgres.I've noticed when dealing with large streams, this operator creates a bottleneck for two reasons:
I've changed a local copy to look as follows:
MS Docs on DbContextFactory
This allows multiple streams to write to the database at the same time, and crucially, disposes the DbContext after each operation (considerably improving performance/memory overhead in the change tracker).
On my sample of 500k+ entries the import is now silky smooth.
Was there a deliberate design decision behind this?
The text was updated successfully, but these errors were encountered: