开发者

NHibernate CreateSQLQuery Transaction Issue

I have a simple method that does...

Session.CreateSQLQuery(syntax).List<T>();

The issue is that when I execute this against a stored procedure that enlists a linked se开发者_如何学运维rver connection I get the following error...

The operation could not be performed because OLE DB provider "MSDASQL" for linked server "MyLinkedServer" was unable to begin a distributed transaction.

My question is; how can I tell NHibernate I do not want to use a transaction..?

Thanks..!


I usually do like this:

session = PersistenceManager.GetCurrentSession();                
IList<T> lst;
using ( var trans = session.BeginTransaction() )
{
    IQuery sql = session.CreateSQLQuery(syntax);
    lst = slq.List<T>();
    trans.Commit();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜