internal void MakeActive()
 {
     // Making a Tx Inactive means it will start listening to events on XLINQ tree
     status = XmlTransactionStatus.Active;
     foreach (var logger in resources.Values)
     {
         logger.Start();
     }
 }
        /// <summary>
        ///     This API supports the Entity Framework infrastructure and is not intended to be used directly from your code.
        /// </summary>
        public override void Commit()
        {
            if (status == XmlTransactionStatus.Committed
                || status == XmlTransactionStatus.Aborted)
            {
                throw new XmlTransactionException(Resources.VanillaProvider_TxAlreadyCompleted);
            }

            try
            {
                if (parent != null)
                {
                    // This is a Child Tx
                    parent.AppendCommands(this);
                }

                status = XmlTransactionStatus.Committed;
            }
            catch
            {
                Rollback();
                throw;
            }

            manager.Commit(this);
        }
        public override void Rollback()
        {
            if (status == XmlTransactionStatus.Committed
                || status == XmlTransactionStatus.Aborted)
            {
                throw new XmlTransactionException(Resources.VanillaProvider_TxAlreadyCompleted);
            }

            try
            {
                // If Store is null, then it means this is a Tx created by XmlEditor
                // In that case XmlEditor will probably drop the current tree anyways
                if (provider != null)
                {
                    // Client wants to rollback, so undo changes on XLINQ tree
                    UndoTransaction();
                }
            }
            catch
            {
                // TODO: Changes cannot be rolled back now, drop the current tree and re-parse whole document
            }
            finally
            {
                status = XmlTransactionStatus.Aborted;
                manager.Rollback(this);
            }
        }
        internal SimpleTransaction(
            VanillaXmlModelProvider provider, string name, SimpleTransaction parent, SimpleTransactionManager mgr, object userState)
        {
            this.provider = provider;
            this.name = name;
            this.parent = parent;
            manager = mgr;
            DesignerTransaction = true;

            resources = new Dictionary<XDocument, SimpleTransactionLogger>();
            status = XmlTransactionStatus.Active;
            _userState = userState;
        }