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


C# NeoDatis.SetHeader方法代码示例

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


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

示例1: UpdateNonNativeObjectInfo


//.........这里部分代码省略.........
					// To know what must be upated we must get the meta
					// representation of this object before
					// The modification. Taking this 'old' meta representation from
					// the
					// cache does not resolve
					// : because cache is a reference to the real object and object
					// has been changed,
					// so the cache is pointing to the reference, that has changed!
					// This old meta representation must be re-read from the last
					// committed database
					// false, = returnInstance (java object) = false
					try
					{
						bool useCache = !objectIsInConnectedZone;
						oldMetaRepresentation = objectReader.ReadNonNativeObjectInfoFromPosition(null, oid
							, currentPosition, useCache, false);
						tmpCache.ClearObjectInfos();
					}
					catch (NeoDatis.Odb.ODBRuntimeException e)
					{
						throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
							.AddParameter("Error while reading old Object Info of oid " + oid + " at pos " +
							 currentPosition), e);
					}
					// Make sure we work with the last version of the object
					int onDiskVersion = oldMetaRepresentation.GetHeader().GetObjectVersion();
					long onDiskUpdateDate = oldMetaRepresentation.GetHeader().GetUpdateDate();
					int inCacheVersion = lastHeader.GetObjectVersion();
					long inCacheUpdateDate = lastHeader.GetUpdateDate();
					if (onDiskUpdateDate > inCacheUpdateDate || onDiskVersion > inCacheVersion)
					{
						lastHeader = oldMetaRepresentation.GetHeader();
					}
					nnoi.SetHeader(lastHeader);
					// increase the object version number from the old meta
					// representation
					nnoi.GetHeader().IncrementVersionAndUpdateDate();
					// Keep the creation date
					nnoi.GetHeader().SetCreationDate(oldMetaRepresentation.GetHeader().GetCreationDate
						());
					// Set the object of the old meta to make the object comparator
					// understand, they are 2
					// meta representation of the same object
					// TODO , check if if is the best way to do
					oldMetaRepresentation.SetObject(nnoi.GetObject());
					// Reset the comparator
					comparator.Clear();
					objectHasChanged = comparator.HasChanged(oldMetaRepresentation, nnoi);
					if (!objectHasChanged)
					{
						fsi.SetWritePosition(positionBeforeWrite, true);
						if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
						{
							NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "updateObject : Object is unchanged - doing nothing"
								);
						}
						return oid;
					}
					if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
					{
						NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "\tmax recursion level is " + comparator
							.GetMaxObjectRecursionLevel());
						NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "\tattribute actions are : " + comparator
							.GetChangedAttributeActions());
						NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "\tnew objects are : " + comparator
							.GetNewObjects());
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:67,代码来源:AbstractObjectWriter.cs


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