public void HandleTCStateChangedEvent(object sender, TCStateChangedEventArgs args)
        {
            TransactionContext trCtx = (TransactionContext)sender;

            //here check the event & commit/rollback etc
            switch(trCtx.State)
            {
                case TransactionContextState.Entered:
                    ServiceDomain.Enter(CreateServiceConfig(trCtx));
                    break;

                case TransactionContextState.ToBeCommitted:
                    ContextUtil.SetComplete();
                    break;

                case TransactionContextState.ToBeRollbacked:
                    ContextUtil.SetAbort();
                    break;

                case TransactionContextState.Exitted:
                    ServiceDomain.Leave();
                    break;

                default:
                    throw new Exception("Unexpected TransactionContextState:" + args.FromState.ToString());
            }
        }
        public void HandleTCStateChangedEvent(object sender, TCStateChangedEventArgs args)
        {
            TransactionContext trCtx = (TransactionContext)sender;

            //here check the event & commit/rollback etc
            switch(trCtx.State)
            {
                case TransactionContextState.Entered:
                    TransactionContext contrTrCtx = trCtx.GetControllingContext();
                    if(contrTrCtx != null && !dataSourceTransactionsByTrCtx.Contains(contrTrCtx))
                        dataSourceTransactionsByTrCtx.Add(contrTrCtx, new Hashtable());
                    break;

                case TransactionContextState.ToBeCommitted:
                    break;

                case TransactionContextState.ToBeRollbacked:
                    break;

                case TransactionContextState.Exitted:
                    if(dataSourceTransactionsByTrCtx.Contains(trCtx))
                    {
                        switch(args.FromState)
                        {
                            case TransactionContextState.ToBeCommitted:
                                CommitTransactions(trCtx);
                                break;
                            case TransactionContextState.ToBeRollbacked:
                                RollbackTransactions(trCtx);
                                break;
                        }
                        dataSourceTransactionsByTrCtx.Remove(trCtx);
                    }
                    break;

                default:
                    throw new Exception("Unexpected TransactionContextState:" + args.FromState.ToString());
            }
        }
        public void HandleTCStateChangedEvent(object sender, TCStateChangedEventArgs args)
        {
            TransactionContext trCtx = (TransactionContext)sender;

            ESTransactionContext currentDtrCtx = PeekLastContext();

            //here check the event & commit/rollback etc
            switch(trCtx.State)
            {
                case TransactionContextState.Entered:
                    ESTransactionContext newDtrCtx = null;
                    if(currentDtrCtx != null)
                        newDtrCtx = currentDtrCtx.CreateContext(trCtx.Affinity);
                    else
                        newDtrCtx = CreateContext(trCtx.Affinity);

                    Contexts.Add(newDtrCtx);
                    break;

                case TransactionContextState.ToBeCommitted:
                    currentDtrCtx.VoteComplete();
                    break;

                case TransactionContextState.ToBeRollbacked:
                    try
                    {
                        currentDtrCtx.VoteAbort();
                    }
                    catch {}	//suppress CONTEXT_E_ABORTED exception for a parent ctx(better way?)
                    break;

                case TransactionContextState.Exitted:
                    Contexts.RemoveAt(Contexts.Count - 1);

                    try
                    {
                        currentDtrCtx.Exit();
                        currentDtrCtx.Dispose();
                    }
                    catch {}	//suppress CONTEXT_E_ABORTED exception for a parent ctx(better way?)
                    break;

                default:
                    throw new Exception("Unexpected TransactionContextState:" + args.FromState.ToString());
            }
        }