当前位置: 首页>>代码示例>>C#>>正文


C# NeoDatis.SetLastObjectInfoHeader方法代码示例

本文整理汇总了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);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:74,代码来源:AbstractObjectWriter.cs


注:本文中的NeoDatis.SetLastObjectInfoHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。