开发者

Nhibernate and Multithreading

开发者 https://www.devze.com 2023-01-30 18:00 出处:网络
i have a multi-threading applications it has something like this: Thread1: while(true) { //read data //change and update

i have a multi-threading applications it has something like this:

Thread1:

    while(true)
    {
         //read data 

         //change and update
           thread.sleep(500);
    }

Thread2:

    //UpdateDate from time to time based on an event from somewhere else....

the application crash only in release time and it point out that a method in nhibernate "aftercommit" or something crashes i assume it something has to do with threading and nhiberna开发者_如何学编程te i can think of a solution for this by disableing cache or something in nhibernate.

has any one faced something similar ? any idea how to completely disable caching ?

Environment:

Windows7. .net4 Nhibernate 2.1 Windows Forms nhibernate dataaccess generated by codesmith nhibernate template.


The only artifact that is thread safe in nhibernate is the session factory. Make sure that you are not using the same session between different threads.

0

精彩评论

暂无评论...
验证码 换一张
取 消