本文整理汇总了C#中NeoDatis.GetNextObjectOID方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetNextObjectOID方法的具体用法?C# NeoDatis.GetNextObjectOID怎么用?C# NeoDatis.GetNextObjectOID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetNextObjectOID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNonNativeObjectInfo
//.........这里部分代码省略.........
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
// 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
示例2: Delete
public virtual NeoDatis.Odb.OID Delete(NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
header)
{
NeoDatis.Odb.Core.Transaction.ISession lsession = GetSession();
NeoDatis.Odb.Core.Transaction.ICache cache = lsession.GetCache();
long objectPosition = header.GetPosition();
NeoDatis.Odb.OID classInfoId = header.GetClassInfoId();
NeoDatis.Odb.OID oid = header.GetOid();
// gets class info from in memory meta model
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = GetSession().GetMetaModel().GetClassInfoFromId
(classInfoId);
bool withIndex = !ci.GetIndexes().IsEmpty();
NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = null;
// When there is index,we must *always* load the old meta representation
// to compute index keys
if (withIndex)
{
nnoi = objectReader.ReadNonNativeObjectInfoFromPosition(ci, header.GetOid(), objectPosition
, true, false);
}
// a boolean value to indicate if object is in connected zone or not
// This will be used to know if work can be done out of transaction
// for unconnected object,changes can be written directly, else we must
// use Transaction (using WriteAction)
bool objectIsInConnectedZone = cache.ObjectWithIdIsInCommitedZone(header.GetOid()
);
// triggers
// FIXME
triggerManager.ManageDeleteTriggerBefore(ci.GetFullClassName(), null, header.GetOid
());
long nbObjects = ci.GetNumberOfObjects();
NeoDatis.Odb.OID previousObjectOID = header.GetPreviousObjectOID();
NeoDatis.Odb.OID nextObjectOID = header.GetNextObjectOID();
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
{
NeoDatis.Tool.DLogger.Debug("Deleting object with id " + header.GetOid() + " - In connected zone ="
+ objectIsInConnectedZone + " - with index =" + withIndex);
NeoDatis.Tool.DLogger.Debug("position = " + objectPosition + " | prev oid = " +
previousObjectOID + " | next oid = " + nextObjectOID);
}
bool isFirstObject = previousObjectOID == null;
bool isLastObject = nextObjectOID == null;
bool mustUpdatePreviousObjectPointers = false;
bool mustUpdateNextObjectPointers = false;
bool mustUpdateLastObjectOfCI = false;
if (isFirstObject || isLastObject)
{
if (isFirstObject)
{
// The deleted object is the first, must update first instance
// OID field of the class
if (objectIsInConnectedZone)
{
// update first object oid of the class info in memory
ci.GetCommitedZoneInfo().first = nextObjectOID;
}
else
{
// update first object oid of the class info in memory
ci.GetUncommittedZoneInfo().first = nextObjectOID;
}
if (nextObjectOID != null)
{
// Update next object 'previous object oid' to null
UpdatePreviousObjectFieldOfObjectInfo(nextObjectOID, null, objectIsInConnectedZone
);
mustUpdateNextObjectPointers = true;
}
}
// It can be first and last
if (isLastObject)
{
// The deleted object is the last, must update last instance
// OID field of the class
// update last object position of the class info in memory
if (objectIsInConnectedZone)
{
// the object is a committed object
ci.GetCommitedZoneInfo().last = previousObjectOID;
}
else
{
// The object is not committed and it is the last and is
// being deleted
ci.GetUncommittedZoneInfo().last = previousObjectOID;
}
if (previousObjectOID != null)
{
// Update 'next object oid' of previous object to null
// if we are in unconnected zone, change can be done
// directly,else it must be done in transaction
UpdateNextObjectFieldOfObjectInfo(previousObjectOID, null, objectIsInConnectedZone
);
// Now update data of the cache
mustUpdatePreviousObjectPointers = true;
mustUpdateLastObjectOfCI = true;
}
}
}
else
//.........这里部分代码省略.........