コード例 #1
0
 internal QConClass(Transaction trans, QCon parent, QField field, IReflectClass claxx
                    ) : base(trans, parent, field, null)
 {
     // C/S
     if (claxx != null)
     {
         ObjectContainerBase container = trans.Container();
         _classMetadata = container.ClassMetadataForReflectClass(claxx);
         if (_classMetadata == null)
         {
             // could be an aliased class, try to resolve.
             string className        = claxx.GetName();
             string aliasRunTimeName = container.Config().ResolveAliasStoredName(className);
             if (!className.Equals(aliasRunTimeName))
             {
                 _classMetadata = container.ClassMetadataForName(aliasRunTimeName);
             }
         }
         if (claxx.Equals(container._handlers.IclassObject))
         {
             _classMetadata = (ClassMetadata)_classMetadata.TypeHandler();
         }
     }
     _claxx = claxx;
 }
コード例 #2
0
        private static ClassMetadata DetectElementTypeErasingNullables(ObjectContainerBase container, IEnumerable collection)
        {
            Type elementType = ElementTypeOf(collection);

            if (IsNullableInstance(elementType))
            {
                return(container.ClassMetadataForReflectClass(container.Handlers.IclassObject));
            }
            return(container.ProduceClassMetadata(container.Reflector().ForClass(elementType)));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: QCandidate.cs プロジェクト: masroore/db4o
 internal virtual IPreparedComparison PrepareComparison(ObjectContainerBase container
     , object constraint)
 {
     var context = container.Transaction.Context();
     if (_fieldMetadata != null)
     {
         return _fieldMetadata.PrepareComparison(context, constraint);
     }
     if (_classMetadata != null)
     {
         return _classMetadata.PrepareComparison(context, constraint);
     }
     IReflector reflector = container.Reflector();
     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)
         {
             var arrayElementTypehandler = classMetadata.TypeHandler();
             if (reflector.Array().IsNDimensional(MemberClass()))
             {
                 var mah = new MultidimensionalArrayHandler(arrayElementTypehandler
                     , false);
                 return mah.PrepareComparison(context, _member);
             }
             var ya = new ArrayHandler(arrayElementTypehandler, false);
             return ya.PrepareComparison(context, _member);
         }
         return classMetadata.PrepareComparison(context, constraint);
     }
     return null;
 }
コード例 #5
0
        private bool HasIdentity(IReflectClass clazz)
        {
            ClassMetadata clazzMeta = _container.ClassMetadataForReflectClass(clazz);

            return(clazzMeta == null || clazzMeta.HasIdentity());
        }