本文整理汇总了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());