private ITypeHandler4 TypeHandlerFor(IInternalCandidate candidate) { Db4objects.Db4o.Internal.ClassMetadata classMetadata = candidate.ClassMetadata(); if (classMetadata != null) { return(classMetadata.TypeHandler()); } return(null); }
private ITypeHandler4 TypeHandlerFor(Db4objects.Db4o.Internal.Query.Processor.QCandidate candidate) { Db4objects.Db4o.Internal.ClassMetadata classMetadata = candidate.ReadClassMetadata (); if (classMetadata != null) { return(classMetadata.TypeHandler()); } return(null); }
private void AssertClassHandler() { int id1 = StoreItem(); int id2 = StoreItem(); int smallerID = Math.Min(id1, id2); int biggerID = Math.Max(id1, id2); ClassMetadata classMetadata = new ClassMetadata(Container(), Reflector().ForClass (typeof(Comparable4TestCase.Item))); AssertHandlerComparison((IComparable4)classMetadata.TypeHandler(), smallerID, biggerID ); }
public virtual void WriteUpdate(Db4objects.Db4o.Internal.Transaction transaction, IUpdateDepth updatedepth) { ContinueSet(transaction, updatedepth); // make sure, a concurrent new, possibly triggered by objectOnNew // is written to the file // preventing recursive if (!BeginProcessing()) { return; } object obj = GetObject(); if (!ObjectCanUpdate(transaction, obj) || !IsActive() || obj == null || !ClassMetadata ().IsModified(obj)) { EndProcessing(); return; } MarshallingContext context = new MarshallingContext(transaction, this, updatedepth , false); if (context.UpdateDepth().Negative()) { EndProcessing(); return; } ObjectContainerBase container = transaction.Container(); LogEvent(container, "update", Const4.State); SetStateClean(); context.PurgeFieldIndexEntriesOnUpdate(transaction, container._handlers.ArrayType (obj)); Handlers4.Write(_class.TypeHandler(), context, obj); if (context.UpdateDepth().CanSkip(this)) { EndProcessing(); return; } Pointer4 pointer = context.AllocateSlot(); ByteArrayBuffer buffer = context.ToWriteBuffer(pointer); container.WriteUpdate(transaction, pointer, _class, container._handlers.ArrayType (obj), buffer); if (IsActive()) { SetStateClean(); } EndProcessing(); container.Callbacks().ObjectOnUpdate(transaction, this); ClassMetadata().DispatchEvent(transaction, obj, EventDispatchers.Update); }
internal virtual IPreparedComparison PrepareComparison(ObjectContainerBase container , object constraint) { IContext context = container.Transaction.Context(); if (_fieldMetadata != null) { return(_fieldMetadata.PrepareComparison(context, constraint)); } if (_classMetadata != null) { return(_classMetadata.PrepareComparison(context, constraint)); } IReflector reflector = container.Reflector(); Db4objects.Db4o.Internal.ClassMetadata classMetadata = null; if (_bytes != null) { classMetadata = container.ProduceClassMetadata(reflector.ForObject(constraint)); } else { if (_member != null) { classMetadata = container.ClassMetadataForReflectClass(reflector.ForObject(_member )); } } if (classMetadata != null) { if (_member != null && _member.GetType().IsArray) { ITypeHandler4 arrayElementTypehandler = classMetadata.TypeHandler(); if (reflector.Array().IsNDimensional(MemberClass())) { MultidimensionalArrayHandler mah = new MultidimensionalArrayHandler(arrayElementTypehandler , false); return(mah.PrepareComparison(context, _member)); } ArrayHandler ya = new ArrayHandler(arrayElementTypehandler, false); return(ya.PrepareComparison(context, _member)); } return(classMetadata.PrepareComparison(context, constraint)); } return(null); }
private void MapPrimitive(int id, ClassMetadata classMetadata, IReflectClass classReflector ) { MapClassToTypeHandler(classReflector, classMetadata.TypeHandler()); if (classReflector != null) { _mapReflectorToClassMetadata.Put(classReflector, classMetadata); } }