Example #1
0
            public object Run()
            {
                QueryingReadContext context = null;

                if (Handlers4.HandleAsObject(arrayElementHandler))
                {
                    // TODO: Code is similar to FieldMetadata.collectIDs. Try to refactor to one place.
                    int             collectionID       = buffer.ReadInt();
                    ByteArrayBuffer arrayElementBuffer = this._enclosing.Container().ReadBufferById(this
                                                                                                    ._enclosing.Transaction(), collectionID);
                    ObjectHeader objectHeader = ObjectHeader.ScrollBufferToContent(this._enclosing.Container
                                                                                       (), arrayElementBuffer);
                    context = new QueryingReadContext(this._enclosing.Transaction(), candidates, this
                                                      ._enclosing._handlerVersion, arrayElementBuffer, collectionID);
                    objectHeader.ClassMetadata().CollectIDs(context);
                }
                else
                {
                    context = new QueryingReadContext(this._enclosing.Transaction(), candidates, this
                                                      ._enclosing._handlerVersion, buffer, 0);
                    ((ICascadingTypeHandler)arrayElementHandler).CollectIDs(context);
                }
                Tree.Traverse(context.Ids(), new _IVisitor4_336(candidates));
                IEnumerator i = context.ObjectsWithoutId();

                while (i.MoveNext())
                {
                    object obj = i.Current;
                    candidates.Add(new Db4objects.Db4o.Internal.Query.Processor.QCandidate(candidates
                                                                                           , obj, 0));
                }
                return(null);
            }
        public virtual void Delete(ITypeHandler4 handler)
        {
            ITypeHandler4 correctHandlerVersion = HandlerRegistry.CorrectHandlerVersion(this,
                                                                                        handler);
            int preservedCascadeDepth = CascadeDeleteDepth();

            CascadeDeleteDepth(AdjustedDepth());
            if (Handlers4.HandleAsObject(correctHandlerVersion))
            {
                DeleteObject();
            }
            else
            {
                correctHandlerVersion.Delete(this);
            }
            CascadeDeleteDepth(preservedCascadeDepth);
        }