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


C# NeoDatis.GetHeader方法代码示例

本文整理汇总了C#中NeoDatis.GetHeader方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetHeader方法的具体用法?C# NeoDatis.GetHeader怎么用?C# NeoDatis.GetHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NeoDatis的用法示例。


在下文中一共展示了NeoDatis.GetHeader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateNonNativeObjectInfo

		public override NeoDatis.Odb.OID UpdateNonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, bool forceUpdate)
		{
			// To enable object auto-reconnect on the server side
			if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && nnoi.GetHeader()
				.GetOid() != null)
			{
				NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					)sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification
					(), true);
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid
					(nnoi.GetOid(), false);
				// only add in th cache if object does not exist in the cache
				if (oih == null)
				{
					session.GetCache().AddObjectInfo(nnoi.GetHeader());
				}
			}
			NeoDatis.Odb.OID roid = base.UpdateNonNativeObjectInfo(nnoi, forceUpdate);
			if (nnoi is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo)
			{
				NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo
					)nnoi;
				NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					)GetSession();
				session.AssociateIds(cnnoi.GetOid(), cnnoi.GetLocalOid());
			}
			return roid;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:29,代码来源:ServerObjectWriter.cs

示例2: WriteNonNativeObjectInfo

		public override NeoDatis.Odb.OID WriteNonNativeObjectInfo(NeoDatis.Odb.OID existingOid
			, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo objectInfo, long position
			, bool writeDataInTransaction, bool isNewObject)
		{
			// To enable object auto-reconnect on the server side
			if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && objectInfo.GetHeader
				().GetOid() != null)
			{
				NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					)sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification
					(), true);
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid
					(objectInfo.GetOid(), false);
				// only add in th cache if object does not exist in the cache
				if (oih == null)
				{
					session.GetCache().AddObjectInfo(objectInfo.GetHeader());
				}
			}
			NeoDatis.Odb.OID roid = base.WriteNonNativeObjectInfo(existingOid, objectInfo, position
				, writeDataInTransaction, isNewObject);
			if (objectInfo is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo)
			{
				NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo
					)objectInfo;
				NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					)GetSession();
				session.AssociateIds(roid, cnnoi.GetLocalOid());
				// Adds the abstract Objectinfo in the cache
				session.GetCache().AddObjectInfo(cnnoi.GetHeader());
			}
			return roid;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:33,代码来源:ServerObjectWriter.cs

示例3: WriteNonNativeObjectInfo


//.........这里部分代码省略.........
			// BlockSize + Block Type + ObjectId + ClassInfoId + Previous + Next +
			// CreatDate + UpdateDate + VersionNumber + ObjectRef + isSync + NbAttri
			// + Attributes
			// Int + Int + Long + Long + Long + Long + Long + Long + int + Long +
			// Bool + int + variable
			// 7 Longs + 4Ints + 1Bool + variable
			int tsize = 7 * NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.SizeOfLong + 3 * NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
				.SizeOfInt + 2 * NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.SizeOfByte;
			byte[] bytes = new byte[tsize];
			// Block size
			byteArrayConverter.IntToByteArray(0, bytes, 0);
			// Block type
			bytes[4] = NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes.BlockTypeNonNativeObject;
			// fsi.writeInt(BlockTypes.BLOCK_TYPE_NON_NATIVE_OBJECT,
			// writeDataInTransaction, "block size");
			// The object id
			EncodeOid(oid, bytes, 5);
			// fsi.writeLong(oid.getObjectId(), writeDataInTransaction, "oid",
			// DefaultWriteAction.DATA_WRITE_ACTION);
			// Class info id
			byteArrayConverter.LongToByteArray(classInfo.GetId().GetObjectId(), bytes, 13);
			// fsi.writeLong(classInfo.getId().getObjectId(),
			// writeDataInTransaction, "class info id",
			// DefaultWriteAction.DATA_WRITE_ACTION);
			// previous instance
			EncodeOid(objectInfo.GetPreviousObjectOID(), bytes, 21);
			// writeOid(objectInfo.getPreviousObjectOID(), writeDataInTransaction,
			// "prev instance", DefaultWriteAction.DATA_WRITE_ACTION);
			// next instance
			EncodeOid(objectInfo.GetNextObjectOID(), bytes, 29);
			// writeOid(objectInfo.getNextObjectOID(), writeDataInTransaction,
			// "next instance", DefaultWriteAction.DATA_WRITE_ACTION);
			// creation date, for update operation must be the original one
			byteArrayConverter.LongToByteArray(objectInfo.GetHeader().GetCreationDate(), bytes
				, 37);
			// fsi.writeLong(objectInfo.getHeader().getCreationDate(),
			// writeDataInTransaction, "creation date",
			// DefaultWriteAction.DATA_WRITE_ACTION);
			byteArrayConverter.LongToByteArray(NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs
				(), bytes, 45);
			// fsi.writeLong(OdbTime.getCurrentTimeInMs(), writeDataInTransaction,
			// "update date", DefaultWriteAction.DATA_WRITE_ACTION);
			// TODO check next version number
			byteArrayConverter.IntToByteArray(objectInfo.GetHeader().GetObjectVersion(), bytes
				, 53);
			// fsi.writeInt(objectInfo.getHeader().getObjectVersion(),
			// writeDataInTransaction, "object version number");
			// not used yet. But it will point to an internal object of type
			// ObjectReference that will have details on the references:
			// All the objects that point to it: to enable object integrity
			byteArrayConverter.LongToByteArray(-1, bytes, 57);
			// fsi.writeLong(-1, writeDataInTransaction, "object reference pointer",
			// DefaultWriteAction.DATA_WRITE_ACTION);
			// True if this object have been synchronized with main database, else
			// false
			byteArrayConverter.BooleanToByteArray(false, bytes, 65);
			// fsi.writeBoolean(false, writeDataInTransaction,
			// "is syncronized with external db");
			// now write the number of attributes and the position of all
			// attributes, we do not know them yet, so write 00 but at the end
			// of the write operation
			// These positions will be updated
			// The positions that is going to be written are 'int' representing
			// the offset position of the attribute
			// first write the number of attributes
			// fsi.writeInt(nbAttributes, writeDataInTransaction, "nb attr");
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:67,代码来源:AbstractObjectWriter.cs

示例4: UpdateNonNativeObjectInfo

		/// <summary>Updates an object.</summary>
		/// <remarks>
		/// Updates an object.
		/// <pre>
		/// Try to update in place. Only change what has changed. This is restricted to particular types (fixed size types). If in place update is
		/// not possible, then deletes the current object and creates a new at the end of the database file and updates
		/// OID object position.
		/// &#064;param object The object to be updated
		/// &#064;param forceUpdate when true, no verification is done to check if update must be done.
		/// &#064;return The oid of the object, as a negative number
		/// &#064;
		/// </remarks>
		public virtual NeoDatis.Odb.OID UpdateNonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, bool forceUpdate)
		{
			nbCallsToUpdate++;
			bool hasObject = true;
			string message = null;
			object @object = nnoi.GetObject();
			NeoDatis.Odb.OID oid = nnoi.GetOid();
			if (@object == null)
			{
				hasObject = false;
			}
			// When there is index,we must *always* load the old meta representation
			// to compute index keys
			bool withIndex = !nnoi.GetClassInfo().GetIndexes().IsEmpty();
			NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo oldMetaRepresentation = 
				null;
			// Used to check consistency, at the end, the number of
			// nbConnectedObjects must and nbUnconnected must remain unchanged
			long nbConnectedObjects = nnoi.GetClassInfo().GetCommitedZoneInfo().GetNbObjects(
				);
			long nbNonConnectedObjects = nnoi.GetClassInfo().GetUncommittedZoneInfo().GetNbObjects
				();
			bool objectHasChanged = false;
			try
			{
				NeoDatis.Odb.Core.Transaction.ISession lsession = GetSession();
				long positionBeforeWrite = fsi.GetPosition();
				NeoDatis.Odb.Core.Transaction.ITmpCache tmpCache = lsession.GetTmpCache();
				NeoDatis.Odb.Core.Transaction.ICache cache = lsession.GetCache();
				// Get header of the object (position, previous object position,
				// next
				// object position and class info position)
				// The header must be in the cache.
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader lastHeader = cache.GetObjectInfoHeaderFromOid
					(oid, true);
				if (lastHeader == null)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.UnexpectedSituation
						.AddParameter("Header is null in update"));
				}
				if (lastHeader.GetOid() == null)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
						.AddParameter("Header oid is null for oid " + oid));
				}
				bool objectIsInConnectedZone = cache.ObjectWithIdIsInCommitedZone(oid);
				long currentPosition = lastHeader.GetPosition();
				// When using client server mode, we must re-read the position of
				// the object with oid. Because, another session may
				// have updated the object, and in this case, the position of the
				// object in the cache may be invalid
				// TODO It should be done only when the object has been deleted or
				// updated by another session. Should check this
				// Doing this with new objects (created in the current session, the
				// last committed
				// object position will be negative, in this case we must use the
				// currentPosition
				if (!isLocalMode)
				{
					long lastCommitedObjectPosition = idManager.GetObjectPositionWithOid(oid, false);
					if (lastCommitedObjectPosition > 0)
					{
						currentPosition = lastCommitedObjectPosition;
					}
					// Some infos that come from the client are not set
					// So we overwrite them here : example : object version. Update
					// date is not important here
					// Because, as we are updating the object, the update date will
					// be updated too
					nnoi.GetHeader().SetObjectVersion(lastHeader.GetObjectVersion());
					nnoi.GetHeader().SetUpdateDate(lastHeader.GetUpdateDate());
				}
				// for client server
				if (nnoi.GetPosition() == -1)
				{
					nnoi.GetHeader().SetPosition(currentPosition);
				}
				if (currentPosition == -1)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InstancePositionIsNegative
						.AddParameter(currentPosition).AddParameter(oid).AddParameter("In Object Info Header"
						));
				}
				if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
				{
					message = DepthToSpaces() + "start updating object at " + currentPosition + ", oid="
						 + oid + " : " + (nnoi != null ? nnoi.ToString() : "null");
//.........这里部分代码省略.........
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:101,代码来源:AbstractObjectWriter.cs

示例5: InsertNonNativeObject

		/// <param name="oid">The Oid of the object to be inserted</param>
		/// <param name="nnoi">
		/// The object meta representation The object to be inserted in
		/// the database
		/// </param>
		/// <param name="isNewObject">To indicate if object is new</param>
		/// <returns>The position of the inserted object</returns>
		public virtual NeoDatis.Odb.OID InsertNonNativeObject(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
			 nnoi, bool isNewObject)
		{
			try
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = nnoi.GetClassInfo();
				object @object = nnoi.GetObject();
				// First check if object is already being inserted
				// This method returns -1 if object is not being inserted
				NeoDatis.Odb.OID cachedOid = GetSession().GetCache().IdOfInsertingObject(@object);
				if (cachedOid != null)
				{
					return cachedOid;
				}
				// Then checks if the class of this object already exist in the
				// meta model
				ci = AddClass(ci, true);
				// Resets the ClassInfo in the objectInfo to be sure it contains all
				// updated class info data
				nnoi.SetClassInfo(ci);
				// Mark this object as being inserted. To manage cyclic relations
				// The oid may be equal to -1
				// Later in the process the cache will be updated with the right oid
				GetSession().GetCache().StartInsertingObjectWithOid(@object, oid, nnoi);
				// false : do not write data in transaction. Data are always written
				// directly to disk. Pointers are written in transaction
				NeoDatis.Odb.OID newOid = WriteNonNativeObjectInfo(oid, nnoi, -1, false, isNewObject
					);
				if (newOid != NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant.NullObjectId)
				{
					GetSession().GetCache().AddObject(newOid, @object, nnoi.GetHeader());
				}
				return newOid;
			}
			finally
			{
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:45,代码来源:AbstractObjectWriter.cs

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