This question is locked. New answers and comments are not allowed.
Good morning,
I am getting a strange error when using an SQL Server stored procedure through Telerik ORM all surrounded by a TransactionScope. Everything works fine up until I make a call to a stored procedure (It is just a data retrieval stored procedure, nothing is being inserted, updated or deleted). The error itself is shown below, and I have not been able to find any information on what might be causing it. The code also works if there is no TransactionScope.
Simplified version of code (in pseudocode-ish):
using (TransactionScope scope = new TransactionScope())
{
// Make calls through OpenAccess ORM, includes inserts/updates. This all works.
orm.FlushChanges();
orm.SaveChanges();
// Make call to stored procedure. This causes exception.
scope.Complete();
}
1: Description: May not call commit,rollback and begin in managed transaction environment.
1: Stack Trace: at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
1: at OpenAccessRuntime.ExceptionWrapper.Throw()
1: at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
1: at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.GetConnection(Boolean& isNew)
1: at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.GetConnection(Boolean& isNew)
1: at OpenAccessRuntime.ObjectScope.GetConnection(Boolean& isNew)
1: at Telerik.OpenAccess.OpenAccessContextBase.GetConnection(Boolean& isNew)
1: at Telerik.OpenAccess.OpenAccessContextBase.ExecuteQuery[T](String commandText, CommandType commandType, DbParameter[] parameters)
1: at Rediteq.CampusPro.DataAccess.CampusProEntitiesModel.UspHaeElementinVastuuhenkilo
I am getting a strange error when using an SQL Server stored procedure through Telerik ORM all surrounded by a TransactionScope. Everything works fine up until I make a call to a stored procedure (It is just a data retrieval stored procedure, nothing is being inserted, updated or deleted). The error itself is shown below, and I have not been able to find any information on what might be causing it. The code also works if there is no TransactionScope.
Simplified version of code (in pseudocode-ish):
using (TransactionScope scope = new TransactionScope())
{
// Make calls through OpenAccess ORM, includes inserts/updates. This all works.
orm.FlushChanges();
orm.SaveChanges();
// Make call to stored procedure. This causes exception.
scope.Complete();
}
1: Description: May not call commit,rollback and begin in managed transaction environment.
1: Stack Trace: at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
1: at OpenAccessRuntime.ExceptionWrapper.Throw()
1: at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
1: at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.GetConnection(Boolean& isNew)
1: at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.GetConnection(Boolean& isNew)
1: at OpenAccessRuntime.ObjectScope.GetConnection(Boolean& isNew)
1: at Telerik.OpenAccess.OpenAccessContextBase.GetConnection(Boolean& isNew)
1: at Telerik.OpenAccess.OpenAccessContextBase.ExecuteQuery[T](String commandText, CommandType commandType, DbParameter[] parameters)
1: at Rediteq.CampusPro.DataAccess.CampusProEntitiesModel.UspHaeElementinVastuuhenkilo