本文整理汇总了C#中IObjectSpace.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IObjectSpace.Dispose方法的具体用法?C# IObjectSpace.Dispose怎么用?C# IObjectSpace.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObjectSpace
的用法示例。
在下文中一共展示了IObjectSpace.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloseObjectSpace
protected virtual void CloseObjectSpace(IObjectSpace objectSpace, bool success)
{
if (objectSpace != null && !objectSpace.IsDisposed)
{
if (success)
{
objectSpace.CommitChanges();
}
else
{
objectSpace.Rollback();
}
objectSpace.Dispose();
}
}
示例2: commitObjectSpaceOnLoad
/// <summary>
/// Commits the object space on load.
/// </summary>
/// <param name="objectSpace">The object space.</param>
/// <param name="activeObjectSpaces">The active object spaces.</param>
private void commitObjectSpaceOnLoad(IObjectSpace objectSpace, Dictionary<Guid, IObjectSpace> activeObjectSpaces)
{
var children = from s in activeObjectSpaces.Values
where s is NestedObjectSpace && ((NestedObjectSpace) s).ParentObjectSpace == objectSpace
select s;
foreach (var child in children)
commitObjectSpaceOnLoad(child, activeObjectSpaces);
var newMaps = from c in objectSpace.ModifiedObjects.Cast<object>()
where c is OidMap && ((OidMap) c).NewObject != null
select c as OidMap;
objectSpace.CommitChanges();
newMaps.ToList().ForEach(x => x.FixReference());
objectSpace.CommitChanges();
objectSpace.Dispose();
var sessionId = (from a in activeObjectSpaces where a.Value == objectSpace select a.Key).FirstOrDefault();
activeObjectSpaces.Remove(sessionId);
}