public override NeoDatis.Odb.OID UpdateNonNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi, bool forceUpdate) { // To enable object auto-reconnect on the server side if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && nnoi.GetHeader() .GetOid() != null) { NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession )sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification (), true); NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid (nnoi.GetOid(), false); // only add in th cache if object does not exist in the cache if (oih == null) { session.GetCache().AddObjectInfo(nnoi.GetHeader()); } } NeoDatis.Odb.OID roid = base.UpdateNonNativeObjectInfo(nnoi, forceUpdate); if (nnoi is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo) { NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo )nnoi; NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession )GetSession(); session.AssociateIds(cnnoi.GetOid(), cnnoi.GetLocalOid()); } return(roid); }
public override NeoDatis.Odb.OID WriteNonNativeObjectInfo(NeoDatis.Odb.OID existingOid , NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo objectInfo, long position , bool writeDataInTransaction, bool isNewObject) { // To enable object auto-reconnect on the server side if (NeoDatis.Odb.OdbConfiguration.ReconnectObjectsToSession() && objectInfo.GetHeader ().GetOid() != null) { NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession )sessionManager.GetSession(storageEngine.GetBaseIdentification().GetIdentification (), true); NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = session.GetCache().GetObjectInfoHeaderFromOid (objectInfo.GetOid(), false); // only add in th cache if object does not exist in the cache if (oih == null) { session.GetCache().AddObjectInfo(objectInfo.GetHeader()); } } NeoDatis.Odb.OID roid = base.WriteNonNativeObjectInfo(existingOid, objectInfo, position , writeDataInTransaction, isNewObject); if (objectInfo is NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo) { NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo cnnoi = (NeoDatis.Odb.Core.Server.Layers.Layer2.Meta.ClientNonNativeObjectInfo )objectInfo; NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession )GetSession(); session.AssociateIds(roid, cnnoi.GetLocalOid()); // Adds the abstract Objectinfo in the cache session.GetCache().AddObjectInfo(cnnoi.GetHeader()); } return(roid); }
/// <summary>Create a copy oh this meta object</summary> /// <param name="onlyData">if true, only copy attributes values</param> /// <returns></returns> public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo > cache, bool onlyData) { NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )cache[objectHeader.GetOid()]; if (nnoi != null) { return(nnoi); } if (onlyData) { NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader (); nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo , null, oih.GetAttributesIdentification(), oih.GetAttributeIds()); } else { nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo , null, objectHeader.GetAttributesIdentification(), objectHeader.GetAttributeIds ()); nnoi.GetHeader().SetOid(GetHeader().GetOid()); } NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] newAttributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[attributeValues.Length]; for (int i = 0; i < attributeValues.Length; i++) { newAttributeValues[i] = attributeValues[i].CreateCopy(cache, onlyData); } nnoi.attributeValues = newAttributeValues; cache.Add(objectHeader.GetOid(), nnoi); return(nnoi); }
/// <summary>Create a copy oh this meta object</summary> /// <param name="onlyData">if true, only copy attributes values</param> /// <returns></returns> public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy (System.Collections.Generic.IDictionary<NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo > cache, bool onlyData) { NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo )cache[objectHeader.GetOid()]; if (nnoi != null) { return nnoi; } if (onlyData) { NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader (); nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo , null, oih.GetAttributesIdentification(), oih.GetAttributeIds()); } else { nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo , null, objectHeader.GetAttributesIdentification(), objectHeader.GetAttributeIds ()); nnoi.GetHeader().SetOid(GetHeader().GetOid()); } NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] newAttributeValues = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[attributeValues.Length]; for (int i = 0; i < attributeValues.Length; i++) { newAttributeValues[i] = attributeValues[i].CreateCopy(cache, onlyData); } nnoi.attributeValues = newAttributeValues; cache.Add(objectHeader.GetOid(), nnoi); return nnoi; }