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; }
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))); }
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); }
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; }
private bool HasIdentity(IReflectClass clazz) { ClassMetadata clazzMeta = _container.ClassMetadataForReflectClass(clazz); return(clazzMeta == null || clazzMeta.HasIdentity()); }