Ian
Ian

Reputation: 4909

Concurrent read access in Entity Framework 4

Assuming I am never writing with EF, will never call SaveChanges for example, Is EF safe for concurrent reads from the same ObjectContext?

It may still be initialising a database connection and reading new objects, or updating existing objects (or deleting!) but it won't be writing anything to the db, so no transactions (I assume).

Thanks

Upvotes: 1

Views: 467

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364279

ObjectContext and related EF classes are not thread safe so don't use them for concurrent operations. If you need to run concurrent data access use a new context for every thread.

Upvotes: 2

Related Questions