Esempio n. 1
0
        /// <summary>
        ///     The only thing that this method does is signal the underlying
        ///     XML transaction to 'complete', which will push changes from the XLinq
        ///     tree in the XML model to the XML Editor's parse tree and the VS buffer.
        ///     This *DOES NOT* commit changes to disk and *DOES NOT* modify the XLinq
        ///     tree.
        ///     An appropriate exception is thrown if this
        ///     operation fails and the transaction is left in Open state to allow
        ///     for the possibility of corrections or retries.  If there are no
        ///     failures, the transaction will be in committed state when this
        ///     operation returns.
        /// </summary>
        public void Commit(bool dirtyArtifact)
        {
            if (_createdXmlTxn)
            {
                try
                {
                    _xmlTx.Commit();
                    if (dirtyArtifact)
                    {
                        _artifact.IsDirty = true;
                    }
                }
                catch
                {
                    // an error ocurred while commiting transaction, and if it is not caused by ReloadArtifact, we need to reload artifact
                    if (!_artifact.IsArtifactReloading)
                    {
                        _artifact.ReloadArtifact();
                    }

                    throw;
                }
            }
        }