本文整理汇总了C#中NeoDatis.GetRealMapClassName方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetRealMapClassName方法的具体用法?C# NeoDatis.GetRealMapClassName怎么用?C# NeoDatis.GetRealMapClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetRealMapClassName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteMap
/// <summary>
/// <pre>
/// Write a map to the database
/// This is done by writing the number of element s and then the key and value pair of all elements.
/// </summary>
/// <remarks>
/// <pre>
/// Write a map to the database
/// This is done by writing the number of element s and then the key and value pair of all elements.
/// Example : a map with two string element : '1/olivier' and '2/chico'
/// write 2 (as an int) : the number of elements
/// write 4 times 0 (as long) to reserve the space for the elements positions
/// then write the object '1' and 'olivier', and keeps the two posiitons in the 'positions' array of long
/// then write the object '2' and the string chico' and keep the two position in the 'positions' array of long
/// Then write back all the positions (in this case , 4 positions) after the size of the map
/// @param object
/// @param writeInTransaction To specify if these writes must be done in or out of a transaction
/// @
/// </remarks>
private long WriteMap(NeoDatis.Odb.Core.Layers.Layer2.Meta.MapObjectInfo moi, bool
writeInTransaction)
{
long firstObjectPosition = 0;
long[] positions;
long startPosition = fsi.GetPosition();
WriteNativeObjectHeader(moi.GetOdbTypeId(), moi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
.BlockTypeMapObject, writeInTransaction);
if (moi.IsNull())
{
return startPosition;
}
System.Collections.Generic.IDictionary<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo> map = moi.GetMap();
int mapSize = map.Count;
System.Collections.Generic.IEnumerator<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
> keys = map.Keys.GetEnumerator();
// write the map class
fsi.WriteString(moi.GetRealMapClassName(), false, writeInTransaction);
// write the size of the map
fsi.WriteInt(mapSize, writeInTransaction, "map size");
// build a n array to store all element positions
positions = new long[mapSize * 2];
// Gets the current position, to know later where to put the
// references
firstObjectPosition = fsi.GetPosition();
// reserve space for object positions : write 'mapSize*2' long
// with zero to store each object position
for (int i = 0; i < mapSize * 2; i++)
{
fsi.WriteLong(0, writeInTransaction, "map element pos", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
}
int currentElement = 0;
while (keys.MoveNext())
{
NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo key = keys.Current;
NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo value = map[key];
NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType keyType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
.GetFromClass(key.GetType());
NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType valueType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
.GetFromClass(value.GetType());
positions[currentElement++] = InternalStoreObjectWrapper(key);
positions[currentElement++] = InternalStoreObjectWrapper(value);
}
long positionAfterWrite = fsi.GetPosition();
// now that all objects have been stored, sets their position in the
// space that have been reserved
fsi.SetWritePosition(firstObjectPosition, writeInTransaction);
for (int i = 0; i < mapSize * 2; i++)
{
fsi.WriteLong(positions[i], writeInTransaction, "map real element pos", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
}
// Gos back to the end of the array
fsi.SetWritePosition(positionAfterWrite, writeInTransaction);
return startPosition;
}