public virtual void Activate(IReferenceActivationContext context) { _readCalls++; FieldsToTypeHandlerMigrationTestCase.Item item = (FieldsToTypeHandlerMigrationTestCase.Item )((UnmarshallingContext)context).PersistentObject(); item._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { var item = (ReentratActivatableItem )context.PersistentObject(); item.ActivateForWrite(); }
internal void ActivateServer(IReferenceActivationContext context) { var context2 = (UnmarshallingContext)context; var buffer = (ByteArrayBuffer)context2.Buffer(); if (buffer._offset != ExpectedOffset) { throw new ApplicationException("unexpected offset value, has db4o version changed?"); } // Find total bytes. int storedOffset = buffer._offset; int total = 0; buffer.ReadBytes(16); total += 16; int stringLength = buffer.ReadInt(); total += sizeof(int); buffer.ReadBytes(stringLength); total += stringLength; int xmlLength = buffer.ReadInt(); total += sizeof(int); total += xmlLength; // don't need to do the last read. long id = context.ObjectContainer().Ext().GetID((CmObjectSurrogate)context.PersistentObject()); CachedProjectInformation.Compressor.Write(buffer._buffer, storedOffset, total); // need to tranfer the id to the client in order to populate the id map (m_idMap). // quickest way to do this is to encode it in the compression data. // Can't use BitConverter because of endinenss differences, with the way db4o ByteArrayBuffer encodes int to bytes. CachedProjectInformation.Compressor.Write(GetBytes(id), 0, 8); }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; FieldsToTypeHandlerMigrationTestCase.Item item = (FieldsToTypeHandlerMigrationTestCase.Item )((UnmarshallingContext)context).PersistentObject(); item._id = context.ReadInt() - 42; }
// IReferenceTypeHandler override public override void Activate(IReferenceActivationContext context) { var context2 = (UnmarshallingContext)context; var buffer = (ByteArrayBuffer)context2.Buffer(); // Get the data. ((ModelVersionNumber)context.PersistentObject()).m_modelVersionNumber = buffer.ReadInt(); }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; var item = (Item )((UnmarshallingContext)context).PersistentObject(); item._id = context.ReadInt() - 42; }
// IReferenceTypeHandler override public override void Activate(IReferenceActivationContext context) { var context2 = (UnmarshallingContext)context; var buffer = (ByteArrayBuffer)context2.Buffer(); // Get the data. var cfi = (CustomFieldInfo)context.PersistentObject(); cfi.m_flid = buffer.ReadInt(); cfi.m_fieldType = (CellarPropertyType)buffer.ReadInt(); cfi.m_destinationClass = buffer.ReadInt(); var cvtr = new UnicodeEncoding(); var len = buffer.ReadInt(); cfi.m_classname = cvtr.GetString(buffer.ReadBytes(len)); len = buffer.ReadInt(); cfi.m_fieldname = cvtr.GetString(buffer.ReadBytes(len)); // If we didn't write a marker byte (e.g., older data), this currently returns zero // (or maybe throws a fit, otherwise known as an exception). For any current // database, we explicitly write a zero. byte tag; try { tag = context.ReadByte(); } catch { tag = 0; } while (tag != 0) // label { switch (tag) { case 1: len = buffer.ReadInt(); cfi.Label = cvtr.GetString(buffer.ReadBytes(len)); break; case 2: len = buffer.ReadInt(); cfi.m_fieldHelp = cvtr.GetString(buffer.ReadBytes(len)); break; case 3: len = buffer.ReadInt(); Debug.Assert(len == Guid.Empty.ToByteArray().Length); cfi.m_fieldListRoot = new Guid(buffer.ReadBytes(len)); break; case 4: cfi.m_fieldWs = buffer.ReadInt(); break; } tag = context.ReadByte(); } }
public virtual void Activate(IReferenceActivationContext context) { object collection = context.PersistentObject(); ICollectionInitializer initializer = CollectionInitializer.For(collection); initializer.Clear(); ReadElements(context, initializer, ReadElementTypeHandler(context, context)); initializer.FinishAdding(); }
public virtual void Activate(IReferenceActivationContext context) { object collection = context.PersistentObject(); ICollectionInitializer initializer = CollectionInitializer.For(collection); initializer.Clear(); ReadElements(context, initializer, ReadElementTypeHandler(context, context)); initializer.FinishAdding(); }
public void Activate(IReferenceActivationContext context) { CustomTypeHandlerTestCase.ItemGrandChild item = (CustomTypeHandlerTestCase.ItemGrandChild )((IReferenceActivationContext)context).PersistentObject(); item.age = context.ReadInt(); int check = context.ReadInt(); if (check != 100) { throw new InvalidOperationException(); } }
public virtual void Activate(IReferenceActivationContext context) { ICollection collection = (ICollection)((UnmarshallingContext)context).PersistentObject (); ClearCollection(collection); ITypeHandler4 elementHandler = ReadElementTypeHandler(context, context); int elementCount = context.ReadInt(); for (int i = 0; i < elementCount; i++) { object element = context.ReadObject(elementHandler); AddToCollection(collection, element); } }
public void Activate(IReferenceActivationContext context) { var item = (ItemGrandChild )context.PersistentObject(); item.age = context.ReadInt(); var check = context.ReadInt(); if (check != 100) { throw new InvalidOperationException(); } }
public void Activate(IReferenceActivationContext context) { CustomTypeHandlerTestCase.Item item = (CustomTypeHandlerTestCase.Item)((UnmarshallingContext )context).PersistentObject(); int elementCount = context.ReadInt(); if (elementCount == -1) { return; } item.numbers = new int[elementCount]; for (int i = 0; i < item.numbers.Length; i++) { item.numbers[i] = context.ReadInt(); } }
public virtual void Activate(IReferenceActivationContext context) { var collection = (ICollection)((UnmarshallingContext)context).PersistentObject (); ClearCollection(collection); var elementHandler = ReadElementTypeHandler(context, context); var elementCount = context.ReadInt(); for (var i = 0; i < elementCount; i++) { var element = context.ReadObject(elementHandler); AddToCollection(collection, element); } }
public void Activate(IReferenceActivationContext context) { var item = (Item)((UnmarshallingContext )context).PersistentObject(); var elementCount = context.ReadInt(); if (elementCount == -1) { return; } item.numbers = new int[elementCount]; for (var i = 0; i < item.numbers.Length; i++) { item.numbers[i] = context.ReadInt(); } }
public void Activate(IReferenceActivationContext context) { CustomTypeHandlerTestCase.Item item = (CustomTypeHandlerTestCase.Item)((UnmarshallingContext )context).PersistentObject(); int elementCount = context.ReadInt(); if (elementCount == -1) { return; } item.numbers = new int[elementCount]; for (int i = 0; i < item.numbers.Length; i++) { item.numbers[i] = context.ReadInt(); } }
public virtual void Activate(IReferenceActivationContext context) { UnmarshallingContext unmarshallingContext = (UnmarshallingContext)context; IDictionary map = (IDictionary)unmarshallingContext.PersistentObject(); map.Clear(); KeyValueHandlerPair handlers = ReadKeyValueTypeHandlers(context, context); int elementCount = context.ReadInt(); for (int i = 0; i < elementCount; i++) { object key = unmarshallingContext.ReadFullyActivatedObjectForKeys(handlers._keyHandler ); if (key == null && !unmarshallingContext.LastReferenceReadWasReallyNull()) { continue; } object value = context.ReadObject(handlers._valueHandler); map[key] = value; } }
// IReferenceTypeHandler override public override void Activate(IReferenceActivationContext context) { if (m_serverOnlyMode) { ActivateServer(context); return; } if (m_cache == null) { throw new NullReferenceException("m_cache"); } if (m_identitymap == null) { throw new NullReferenceException("m_identitymap"); } var context2 = (UnmarshallingContext)context; var buffer = (ByteArrayBuffer)context2.Buffer(); // Get Guid and CmObjectId. // Earlier code used a special CmObject.Create() method, I think because it is faster, // and on the assumption that we only activate objects at startup, so none of the // IDs have been seen before. However, with a background thread fluffing things, we // COULD have seen it, even during startup, if we've fluffed some object that references // this one. Also, this code is called in client-server mode when we Refresh an object // to see whether someone else changed it, and then the ID is very likely to exist already. // It MAY be possible to re-introduce the faster ID creation code just during startup // if we're not overlapping fluffing and reading. var reconId = CmObjectId.FromGuid(new Guid(buffer.ReadBytes(16)), m_identitymap); // Get class name. var className = m_unicodeEnc.GetString(buffer.ReadBytes(buffer.ReadInt())); // Get the data. var dataLength = buffer.ReadInt(); // Reconstitute the surrogate. ((CmObjectSurrogate)context.PersistentObject()).InitializeFromDataStore( m_cache, reconId, className, buffer.ReadBytes(dataLength)); }
public virtual void Activate(IReferenceActivationContext context) { UnmarshallingContext unmarshallingContext = (UnmarshallingContext)context; IDictionary map = (IDictionary)unmarshallingContext.PersistentObject(); map.Clear(); KeyValueHandlerPair handlers = ReadKeyValueTypeHandlers(context, context); int elementCount = context.ReadInt(); for (int i = 0; i < elementCount; i++) { object key = unmarshallingContext.ReadFullyActivatedObjectForKeys(handlers._keyHandler ); if (key == null && !unmarshallingContext.LastReferenceReadWasReallyNull()) { continue; } object value = context.ReadObject(handlers._valueHandler); map[key] = value; } }
public virtual void Activate(IReferenceActivationContext context) { ReentrantActivationTestCase.ReentratActivatableItem item = (ReentrantActivationTestCase.ReentratActivatableItem )context.PersistentObject(); item.ActivateForWrite(); }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; ((Item)context.PersistentObject())._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { var bigSet = (IBigSetPersistence) context.PersistentObject(); bigSet.Read(context); }
public void Activate(IReferenceActivationContext context) { CustomTypeHandlerTestCase.ItemGrandChild item = (CustomTypeHandlerTestCase.ItemGrandChild )((IReferenceActivationContext)context).PersistentObject(); item.age = context.ReadInt(); int check = context.ReadInt(); if (check != 100) { throw new InvalidOperationException(); } }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; ((TranslatorToTypehandlerMigrationTestCase.Item)context.PersistentObject())._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { ActivateAspects((UnmarshallingContext) context); }
public virtual void Activate(IReferenceActivationContext context) { ActivateAspects((UnmarshallingContext)context); }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; ((Item) context.PersistentObject())._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; ((TranslatorToTypehandlerMigrationTestCase.Item)context.PersistentObject())._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { _readCalls++; var item = (Item ) ((UnmarshallingContext) context).PersistentObject(); item._id = context.ReadInt() - 42; }
public virtual void Activate(IReferenceActivationContext context) { var bigSet = (IBigSetPersistence)context.PersistentObject(); bigSet.Read(context); }
public void Activate(IReferenceActivationContext context) { var item = (ItemGrandChild ) context.PersistentObject(); item.age = context.ReadInt(); var check = context.ReadInt(); if (check != 100) { throw new InvalidOperationException(); } }
public virtual void Activate(IReferenceActivationContext context) { }
public virtual void Activate(IReferenceActivationContext context) { }
public void Activate(IReferenceActivationContext context) { var item = (Item) ((UnmarshallingContext ) context).PersistentObject(); var elementCount = context.ReadInt(); if (elementCount == -1) { return; } item.numbers = new int[elementCount]; for (var i = 0; i < item.numbers.Length; i++) { item.numbers[i] = context.ReadInt(); } }