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();
}
精彩评论