Query got timeout error in NHibernate but not In SQL Server

前端 未结 2 830
耶瑟儿~
耶瑟儿~ 2021-02-15 14:08

I got a problem with NHibernate in C#.

When it wants to execute a query the application face with a ADO timeout error, but when I use SQL Profiler to capture the query,

2条回答
  •  误落风尘
    2021-02-15 14:33

    well i hv seen nhibernate timeouts occurring when you are dealing with a transaction that is not yet committed to the database and using a different transaction that operates on the same object.. so i would suggest look out for multiple sessions poen within your app and make sure that is not the case and use only 1..

    and also using nhibernate profiles is something that i would suggest too.. http://nhprof.com/ Its a cool tool to have.. it actually shows the query fired to the db and the rows retrieved and is very easy to use too..All you need to do is set the connection string to the dB that u r running the query against and voila u can see all ur queries and u can say good bye to SQL profiler.

    Hope that helps.

提交回复
热议问题