本文整理汇总了C#中NeoDatis.SetLastObjectInfoHeader方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.SetLastObjectInfoHeader方法的具体用法?C# NeoDatis.SetLastObjectInfoHeader怎么用?C# NeoDatis.SetLastObjectInfoHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.SetLastObjectInfoHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ManageNewObjectPointers
/// <summary>Updates pointers of objects, Only changes uncommitted info pointers</summary>
/// <param name="objectInfo">The meta representation of the object being inserted</param>
/// <param name="classInfo">The class of the object being inserted</param>
/// <param name="position">The position where the object is being inserted @</param>
private void ManageNewObjectPointers(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
objectInfo, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo, long position
, NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel)
{
NeoDatis.Odb.Core.Transaction.ICache cache = storageEngine.GetSession(true).GetCache
();
bool isFirstUncommitedObject = !classInfo.GetUncommittedZoneInfo().HasObjects();
// if it is the first uncommitted object
if (isFirstUncommitedObject)
{
classInfo.GetUncommittedZoneInfo().first = objectInfo.GetOid();
NeoDatis.Odb.OID lastCommittedObjectOid = classInfo.GetCommitedZoneInfo().last;
if (lastCommittedObjectOid != null)
{
// Also updates the last committed object next object oid in
// memory to connect the committed
// zone with unconnected for THIS transaction (only in memory)
NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = cache.GetObjectInfoHeaderFromOid
(lastCommittedObjectOid, true);
oih.SetNextObjectOID(objectInfo.GetOid());
// And sets the previous oid of the current object with the last
// committed oid
objectInfo.SetPreviousInstanceOID(lastCommittedObjectOid);
}
}
else
{
// Gets the last object, updates its (next object)
// pointer to the new object and updates the class info 'last
// uncommitted object
// oid' field
NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oip = classInfo.GetLastObjectInfoHeader
();
if (oip == null)
{
throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
.AddParameter("last OIP is null in manageNewObjectPointers oid=" + objectInfo.GetOid
()));
}
if (oip.GetNextObjectOID() != objectInfo.GetOid())
{
oip.SetNextObjectOID(objectInfo.GetOid());
// Here we are working in unconnected zone, so this
// can be done without transaction: actually
// write in database file
UpdateNextObjectFieldOfObjectInfo(oip.GetOid(), oip.GetNextObjectOID(), false);
objectInfo.SetPreviousInstanceOID(oip.GetOid());
// Resets the class info oid: In some case,
// (client // server) it may be -1.
oip.SetClassInfoId(classInfo.GetId());
// object info oip has been changed, we must put it
// in the cache to turn this change available for current
// transaction until the commit
storageEngine.GetSession(true).GetCache().AddObjectInfo(oip);
}
}
// always set the new last object oid and the number of objects
classInfo.GetUncommittedZoneInfo().last = objectInfo.GetOid();
classInfo.GetUncommittedZoneInfo().IncreaseNbObjects();
// Then updates the last info pointers of the class info
// with this new created object
// At this moment, the objectInfo.getHeader() do not have the
// attribute ids.
// but later in this code, the attributes will be set, so the class
// info also will have them
classInfo.SetLastObjectInfoHeader(objectInfo.GetHeader());
// // Saves the fact that something has changed in the class (number of
// objects and/or last object oid)
storageEngine.GetSession(true).GetMetaModel().AddChangedClass(classInfo);
}