Model first - multi thread app

2 posts, 0 answers
  1. Saene
    Saene avatar
    13 posts
    Member since:
    Sep 2008

    Posted 16 Jun 2011 Link to this post

    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!!



  2. PetarP
    PetarP avatar
    754 posts

    Posted 21 Jun 2011 Link to this post

    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,
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
  3. DevCraft banner
Back to Top