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


C# NeoDatis.SetClassInfo方法代码示例

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


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

示例1: WriteNonNativeObjectInfo


//.........这里部分代码省略.........
				// => third parameter(write in transaction) = true
				idManager.UpdateObjectPositionForOid(oid, position, true);
				// Keep the relation of id and position in the cache until the
				// commit
				cache.SavePositionOfObjectWithOid(oid, position);
			}
			// Sets the oid of the object in the inserting cache
			cache.UpdateIdOfInsertingObject(objectInfo.GetObject(), oid);
			// Only add the oid to unconnected zone if it is a new object
			if (isNewObject)
			{
				cache.AddOIDToUnconnectedZone(oid);
				if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession())
				{
					NeoDatis.Odb.Core.Transaction.ICrossSessionCache crossSessionCache = NeoDatis.Odb.Impl.Core.Transaction.CacheFactory
						.GetCrossSessionCache(storageEngine.GetBaseIdentification().GetIdentification());
					crossSessionCache.AddObject(objectInfo.GetObject(), oid);
				}
			}
			objectInfo.SetOid(oid);
			if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
			{
				NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Start Writing non native object of type "
					 + objectInfo.GetClassInfo().GetFullClassName() + " at " + position + " , oid = "
					 + oid + " : " + objectInfo.ToString());
			}
			if (objectInfo.GetClassInfo() == null || objectInfo.GetClassInfo().GetId() == null)
			{
				if (objectInfo.GetClassInfo() != null)
				{
					NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo clinfo = storageEngine.GetSession(
						true).GetMetaModel().GetClassInfo(objectInfo.GetClassInfo().GetFullClassName(), 
						true);
					objectInfo.SetClassInfo(clinfo);
				}
				else
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.UndefinedClassInfo
						.AddParameter(objectInfo.ToString()));
				}
			}
			// updates the meta model - If class already exist, it returns the
			// metamodel class, which contains
			// a bit more informations
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = AddClass(objectInfo.GetClassInfo
				(), true);
			objectInfo.SetClassInfo(classInfo);
			// 
			if (isNewObject)
			{
				ManageNewObjectPointers(objectInfo, classInfo, position, metaModel);
			}
			if (NeoDatis.Odb.OdbConfiguration.SaveHistory())
			{
				classInfo.AddHistory(new NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.History.InsertHistoryInfo
					("insert", oid, position, objectInfo.GetPreviousObjectOID(), objectInfo.GetNextObjectOID
					()));
			}
			fsi.SetWritePosition(position, writeDataInTransaction);
			objectInfo.SetPosition(position);
			int nbAttributes = objectInfo.GetClassInfo().GetAttributes().Count;
			// compute the size of the array of byte needed till the attibute
			// positions
			// BlockSize + Block Type + ObjectId + ClassInfoId + Previous + Next +
			// CreatDate + UpdateDate + VersionNumber + ObjectRef + isSync + NbAttri
			// + Attributes
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:67,代码来源:AbstractObjectWriter.cs

示例2: 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


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