This is a migrated thread and some comments may be shown as answers.

Model first - multi thread app

1 Answer 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Saene
Top achievements
Rank 1
Saene asked on 16 Jun 2011, 11:35 AM
Hi there,

I'm developping a multi threaded windows application, and i use the forward mapping to generate the database and manage my objects (rlinq).

My question is what is the good practice when using a rlinq in a multi threaded application. Should I
  • have only one db context for the application, and in this case, how do I ensure that a SaveChanges() in one thread has no impact on another (to ensure data integrity)?
  • instanciate one db context each time i need, and in this case, how do i manage the fact that an object may be selected with a db context, and updated with another?

Am i right when i say that in the backend configuration, the option "multithreaded context" allows the same db context to be accessed by several threads, but does not ensure that a SaveChanges() called in one thread will have no impact on changes done in another thread on the same db context?

The previous app i've developped used OpenAccess ORM Classic, to manually manage transaction and database concurrence. Do I have to get back use that again?

Is there an example somewhere where i can find information?

I'm a little bit lost, any help would be much appreciated!!

Thanks,

Antoine.

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 21 Jun 2011, 02:35 PM
Hello Saene,

 Our context implementation uses an scope instance internal to communicate with the database. Basically the context acts as an wrapper around your scope and as such it can be used with the same approach you used to have.
You are correct about the multi threaded option. What you need to do in order to ensure the data integrity would be to take advantage of our concurrency mechanism.

All the best,
Petar
the Telerik team
Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Tags
General Discussions
Asked by
Saene
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or