本文整理汇总了C#中NeoDatis.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.IsNull方法的具体用法?C# NeoDatis.IsNull怎么用?C# NeoDatis.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.IsNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteNonNativeObjectInfo
public virtual NeoDatis.Odb.OID WriteNonNativeObjectInfo(NeoDatis.Odb.OID existingOid
, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo objectInfo, long position
, bool writeDataInTransaction, bool isNewObject)
{
NeoDatis.Odb.Core.Transaction.ISession lsession = GetSession();
NeoDatis.Odb.Core.Transaction.ICache cache = lsession.GetCache();
bool hasObject = objectInfo.GetObject() != null;
// Insert triggers for CS Mode, local mode insert triggers are called in the DefaultInstrumentationCallbackForStore class
if (isNewObject && !isLocalMode)
{
triggerManager.ManageInsertTriggerBefore(objectInfo.GetClassInfo().GetFullClassName
(), objectInfo);
}
// Checks if object is null,for null objects,there is nothing to do
if (objectInfo.IsNull())
{
return NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant.NullObjectId;
}
NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = lsession.GetMetaModel(
);
// first checks if the class of this object already exist in the
// metamodel
if (!metaModel.ExistClass(objectInfo.GetClassInfo().GetFullClassName()))
{
AddClass(objectInfo.GetClassInfo(), true);
}
// if position is -1, gets the position where to write the object
if (position == -1)
{
// Write at the end of the file
position = fsi.GetAvailablePosition();
// Updates the meta object position
objectInfo.SetPosition(position);
}
// Gets the object id
NeoDatis.Odb.OID oid = existingOid;
if (oid == null)
{
// If, to get the next id, a new id block must be created, then
// there is an extra work
// to update the current object position
if (idManager.MustShift())
{
oid = idManager.GetNextObjectId(position);
// The id manager wrote in the file so the position for the
// object must be re-computed
position = fsi.GetAvailablePosition();
// The oid must be associated to this new position - id
// operations are always out of transaction
// in this case, the update is done out of the transaction as a
// rollback won t need to
// undo this. We are just creating the id
// => third parameter(write in transaction) = false
idManager.UpdateObjectPositionForOid(oid, position, false);
}
else
{
oid = idManager.GetNextObjectId(position);
}
}
else
{
// If an oid was passed, it is because object already exist and
// is being updated. So we
// must update the object position
// Here the update of the position of the id must be done in
// transaction as the object
// position of the id is being updated, and a rollback should undo
// this
// => 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(
//.........这里部分代码省略.........
示例2: AtomicNativeObjectToString
public static string AtomicNativeObjectToString(NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
anoi, int caller)
{
if (anoi == null || anoi.IsNull())
{
return "null";
}
if (anoi.GetObject() is System.DateTime)
{
if (NeoDatis.Odb.Impl.Tool.ObjectTool.CallerIsOdbExplorer(caller))
{
return format.Format((System.DateTime)anoi.GetObject());
}
return ((System.DateTime)anoi.GetObject()).Millisecond.ToString();
}
return anoi.GetObject().ToString();
}
示例3: WriteNativeObjectInfo
/// <summary>Actually write the object data to the database file</summary>
/// <param name="oidOfObjectToQuery">The object id, can be -1 (not set)</param>
/// <param name="aoi">The object meta infor The object info to be written</param>
/// <param name="position">if -1, it is a new instance, if not, it is an update</param>
/// <param name="updatePointers"></param>
/// <returns>The object posiiton or id(if <0)</returns>
/// <exception cref="System.Exception">System.Exception</exception>
/// <>
/// * public OID writeObjectInfo(OID oid, AbstractObjectInfo
/// aoi, long position, boolean updatePointers) throws Exception
/// { currentDepth++;
/// try {
/// if (aoi.isNative()) { return
/// writeNativeObjectInfo((NativeObjectInfo) aoi, position,
/// updatePointers, false); }
/// return writeNonNativeObjectInfo(oid, aoi, position,
/// updatePointers, false); } finally { currentDepth--; } }
/// </>
private long WriteNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo
noi, long position, bool updatePointers, bool writeInTransaction)
{
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogIdDebug))
{
NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Writing native object at " + position
+ " : Type=" + NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.GetNameFromId(noi.GetOdbTypeId
()) + " | Value=" + noi.ToString());
}
if (noi.IsAtomicNativeObject())
{
return WriteAtomicNativeObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
)noi, writeInTransaction);
}
if (noi.IsNull())
{
WriteNullNativeObjectHeader(noi.GetOdbTypeId(), writeInTransaction);
return position;
}
if (noi.IsCollectionObject())
{
return WriteCollection((NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
)noi, writeInTransaction);
}
if (noi.IsMapObject())
{
return WriteMap((NeoDatis.Odb.Core.Layers.Layer2.Meta.MapObjectInfo)noi, writeInTransaction
);
}
if (noi.IsArrayObject())
{
return WriteArray((NeoDatis.Odb.Core.Layers.Layer2.Meta.ArrayObjectInfo)noi, writeInTransaction
);
}
if (noi.IsEnumObject())
{
return WriteEnumNativeObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.EnumNativeObjectInfo
)noi, writeInTransaction);
}
throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.NativeTypeNotSupported
.AddParameter(noi.GetOdbTypeId()));
}
示例4: WriteAtomicNativeObject
public virtual long WriteAtomicNativeObject(NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
anoi, bool writeInTransaction, int totalSpaceIfString)
{
long startPosition = fsi.GetPosition();
int odbTypeId = anoi.GetOdbTypeId();
WriteNativeObjectHeader(odbTypeId, anoi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
.BlockTypeNativeObject, writeInTransaction);
if (anoi.IsNull())
{
// Even if object is null, reserve space for to simplify/enable in
// place update
fsi.EnsureSpaceFor(anoi.GetOdbType());
return startPosition;
}
object @object = anoi.GetObject();
switch (odbTypeId)
{
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.ByteId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeByteId:
{
fsi.WriteByte(((byte)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BooleanId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeBooleanId:
{
fsi.WriteBoolean(((bool)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.CharacterId:
{
fsi.WriteChar(((char)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeCharId:
{
fsi.WriteChar(@object.ToString()[0], writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.FloatId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeFloatId:
{
fsi.WriteFloat(((float)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DoubleId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeDoubleId:
{
fsi.WriteDouble(((double)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.IntegerId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeIntId:
{
fsi.WriteInt(((int)@object), writeInTransaction, "native attr");
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.LongId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeLongId:
{
fsi.WriteLong(((long)@object), writeInTransaction, "native attr", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.ShortId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeShortId:
{
fsi.WriteShort(((short)@object), writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigDecimalId:
{
fsi.WriteBigDecimal((System.Decimal)@object, writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigIntegerId:
{
fsi.WriteBigInteger((System.Decimal)@object, writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateSqlId:
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateTimestampId:
{
fsi.WriteDate((System.DateTime)@object, writeInTransaction);
break;
}
case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.StringId:
//.........这里部分代码省略.........
示例5: WriteEnumNativeObject
public virtual long WriteEnumNativeObject(NeoDatis.Odb.Core.Layers.Layer2.Meta.EnumNativeObjectInfo
anoi, bool writeInTransaction)
{
long startPosition = fsi.GetPosition();
int odbTypeId = anoi.GetOdbTypeId();
WriteNativeObjectHeader(odbTypeId, anoi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
.BlockTypeNativeObject, writeInTransaction);
// Writes the Enum ClassName
fsi.WriteLong(anoi.GetEnumClassInfo().GetId().GetObjectId(), writeInTransaction,
"enum class info id", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction
);
// Write the Enum String value
fsi.WriteString(anoi.GetObject().ToString(), writeInTransaction, true, -1);
return startPosition;
}
示例6: 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;
}
示例7: WriteCollection
/// <summary>
/// TODO check if we should pass the position instead of requesting if to fsi
/// <pre>
/// Write a collection to the database
/// This is done by writing the number of element s and then the position of all elements.
/// </summary>
/// <remarks>
/// TODO check if we should pass the position instead of requesting if to fsi
/// <pre>
/// Write a collection to the database
/// This is done by writing the number of element s and then the position of all elements.
/// Example : a list with two string element : 'ola' and 'chico'
/// write 2 (as an int) : the number of elements
/// write two times 0 (as long) to reserve the space for the elements positions
/// then write the string 'ola', and keeps its position in the 'positions' array of long
/// then write the string 'chico' and keeps its position in the 'positions' array of long
/// Then write back all the positions (in this case , 2 positions) after the size of the collection
/// <pre>
/// @param coi
/// @param writeInTransaction
/// @
/// </remarks>
private long WriteCollection(NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
coi, bool writeInTransaction)
{
long firstObjectPosition = 0;
long[] attributeIdentifications;
long startPosition = fsi.GetPosition();
WriteNativeObjectHeader(coi.GetOdbTypeId(), coi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
.BlockTypeCollectionObject, writeInTransaction);
if (coi.IsNull())
{
return startPosition;
}
System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
> collection = coi.GetCollection();
int collectionSize = collection.Count;
System.Collections.IEnumerator iterator = collection.GetEnumerator();
// write the real type of the collection
fsi.WriteString(coi.GetRealCollectionClassName(), false, writeInTransaction);
// write the size of the collection
fsi.WriteInt(collectionSize, writeInTransaction, "collection size");
// build a n array to store all element positions
attributeIdentifications = new long[collectionSize];
// Gets the current position, to know later where to put the
// references
firstObjectPosition = fsi.GetPosition();
// reserve space for object positions : write 'collectionSize' long
// with zero to store each object position
for (int i = 0; i < collectionSize; i++)
{
fsi.WriteLong(0, writeInTransaction, "collection element pos ", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
}
int currentElement = 0;
NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo element = null;
while (iterator.MoveNext())
{
element = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
attributeIdentifications[currentElement] = InternalStoreObjectWrapper(element);
currentElement++;
}
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 < collectionSize; i++)
{
fsi.WriteLong(attributeIdentifications[i], writeInTransaction, "collection element real pos "
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
}
// Goes back to the end of the array
fsi.SetWritePosition(positionAfterWrite, writeInTransaction);
return startPosition;
}