CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

TransactionType DB2 and NHibernate - Disconnect cannot be called while a transaction is in progress.

rated by 0 users
Not Answered This post has 0 verified answers | 0 Replies | 1 Follower

Not Ranked
12 Posts
dblwizard posted on Thu, Jun 14 2012 2:35 PM

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
Page 1 of 1 (1 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems