Howdy,
I'm developing a Silverlight application using CSLA(Codesmith) and NHibernate(Codesmith-PLINQO) and when I use a TransactionalType of TransactionScope or EnterpriseServices I get the message: "Disconnect cannot be called while a transaction is in progress." If I set the TransactionType to Manual and use a BeginTransaction and CommitTransaction everything works fine. This is running against a DB2 zOS mainframe database using the IBM 9.7 client.
The error occurs when it tries to dispose of the DataContext from the using statement.
The code below is the functioning code. If you change the TransactionalTypes to anything other than manual the error occurs.
[Transactional(TransactionalTypes.Manual)] protected override void DataPortal_Insert() { //LinqToSQL Modification bool cancel = false; OnInserting(ref cancel); if (cancel) return; // Get Translock data for a single criteria using (var ctx = new DC.ADRPDataContext()) { ctx.BeginTransaction(); DAL.Translock item = new DAL.Translock(); using (BypassPropertyChecks) { item.Itrackingid = this.Itrackingid; item.Suserid = this.Suserid; item.Dlocked = this.Dlocked; } ctx.Translock.InsertOnSubmit(item); ctx.SubmitChanges(); ctx.CommitTransaction(); LoadProperty(_originalItrackingidProperty, this.Itrackingid); OnInserted(); } }
Thanks
dbl
Copyright (c) Marimer LLC