EF6 and threading

EF6 and threading
 
I am converting a working legacy application to EF6 but do not know how to replace the threading.
 
In order to process a large amount of records, an extra table was created where each row contains the unique ID on the main table
AND a "busy" flag. This enabe multiple thread to interact with the entire database yet manage their contention using this table.
 
What can I do in EF6 which would give me this same capability?

And performance is a big concern since the row count is huge.
 
Thanks!
newbiewebSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
That is a great question, but I am not sure that I have a handy dandy answer.  I was reading through this article lately, and it may or may not have the appropriate information that you are looking for.

Managing DbContext the right way with Entity Framework 6: an in-depth guide
http://mehdi.me/ambient-dbcontext-in-ef6/

Many services are heavily parallelized, either by taking advantage of async I/O or (more often) by simply distributing tasks across multiple threads via the TPL's Task.Run() or Parallel.Invoke() methods. So the way we manage our DbContext instances must play well with multi-threading and parallel programming in general. Most of the common approaches suggested to manage DbContext instances don't work at all in this scenario.

In .NET 4.5, ADO.NET introduced (at very long last) support for async database queries. Async support was then included in Entity Framework 6, allowing you to use a fully async workflow for all read and write queries made through EF.

Needless to say that whatever system you use to manage your DbContext instance must play well with Entity Framework's async features.

DbContext is not thread-safe

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
newbiewebSr. Software EngineerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.