Getting up-to-date data on multi-tread app.

Thread is closed for posting
2 posts, 0 answers
  1. Paulhenri
    Paulhenri avatar
    7 posts
    Member since:
    Jan 2013

    Posted 06 May 2014 Link to this post


    I'm working on a muti-thread app, using the one-context-per-thread philosophy. I'm having troubles to load data that are up to date when it has been modified by another thread.

    (so far, to workaround this issue I was instanciating a new context, but now and then it is throwing me a “SqlConnection does not support parallel transactions” exception)

    Is there a way to force my context to load "fresh" data from the database?


  2. Ady
    Ady avatar
    589 posts

    Posted 09 May 2014 Link to this post

    Hello Paulhenri,

     Creating a new context instance should work. Querying with a new context should query the database (unless you have turned on the Level 2 cache). The exception indicates that somehow the same underlying connection is being used from different threads to start a transaction. It seems that the same context is being used from multiple threads.
    Can you send me some sample code that demonstrates your scenario?
    Alternatively you can turn off the OpenAccess connection pool and use the ADO.NET connection pooling by setting the 'BackendConfiguration.ConnectionPool.Pool' property value to 'ADO'.

    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top