本文整理汇总了C#中Microsoft.Data.Entity.Design.Model.Commands.CommandProcessorContext.DisposeTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# CommandProcessorContext.DisposeTransaction方法的具体用法?C# CommandProcessorContext.DisposeTransaction怎么用?C# CommandProcessorContext.DisposeTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Data.Entity.Design.Model.Commands.CommandProcessorContext
的用法示例。
在下文中一共展示了CommandProcessorContext.DisposeTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostProcessUpdate
private void PostProcessUpdate(CommandProcessorContext cpc, EfiTransaction tx, bool artifactInitiallyDirty)
{
var setUndoScope = false;
try
{
// process those checks that need to run in the originating xact
while (cpc.IntegrityChecks.Count > 0)
{
// peek for the next check and invoke it, don't dequeue it so we
// won't add dupes and recurse forever
var check = cpc.IntegrityChecks.Peek();
check.Invoke();
// now pop it off the queue
cpc.IntegrityChecks.Dequeue();
}
if (cpc.EditingContext.ParentUndoUnitStarted == false)
{
cpc.EditingContext.ParentUndoUnitStarted = true;
cpc.Artifact.XmlModelProvider.BeginUndoScope(cpc.EfiTransaction.Name);
setUndoScope = true;
}
if (_shouldNotifyObservers)
{
cpc.Artifact.ModelManager.BeforeCommitChangeGroups(cpc);
}
// Do not mark the artifact as clean if the artifact was initially dirty before commands
// were executed... otherwise we may lose information like diagram layout and configurations.
// Also, translation rules can perform immediate changes to configurations which will dirty the artifact
// but are not recorded through the enqueued commands. So we should not set the artifact to clean in this case.
tx.Commit(!artifactInitiallyDirty);
cpc.DisposeTransaction();
#if DEBUG
var visitor = cpc.Artifact.GetVerifyModelIntegrityVisitor(true, true, true, true, true);
visitor.Traverse(cpc.Artifact);
if (visitor.ErrorCount > 0)
{
Debug.WriteLine("Model Integrity Verifier found " + visitor.ErrorCount + " error(s):");
Debug.WriteLine(visitor.AllSerializedErrors);
Debug.Assert(
false, "Model Integrity Verifier found " + visitor.ErrorCount + " error(s). See the Debug console for details.");
}
#endif
if (_shouldNotifyObservers)
{
cpc.Artifact.ModelManager.RouteChangeGroups();
}
else
{
// Changegroups have been recorded in the model manager;
// if we don't clear them they will be routed on the next observable transaction.
cpc.Artifact.ModelManager.ClearChangeGroups();
}
}
finally
{
if (setUndoScope)
{
cpc.Artifact.XmlModelProvider.EndUndoScope();
cpc.EditingContext.ParentUndoUnitStarted = false;
}
}
}