Пример #1
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;
		}
		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
 public virtual ClassMetadata ClassMetadataForReflectClass(IReflectClass reflectClass
                                                           )
 {
     return(_server.ClassMetadataForReflectClass(reflectClass));
 }