示例#1
0
        public static IEnumerator Iterator(IReflectClass claxx, object obj)
        {
            IReflectArray reflectArray = claxx.Reflector().Array();

            if (reflectArray.IsNDimensional(claxx))
            {
                return(MultidimensionalArrayHandler.AllElementsMultidimensional(reflectArray, obj
                                                                                ));
            }
            return(Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler.AllElements(reflectArray
                                                                                    , obj));
        }
示例#2
0
 public virtual void TestCorrectHandlerVersion()
 {
     var openTypeHandler = new OpenTypeHandler(Container());
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler0), openTypeHandler, -1);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler0), openTypeHandler, 0);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler2), openTypeHandler, 1);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler2), openTypeHandler, 2);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler), openTypeHandler, HandlerRegistry
         .HandlerVersion);
     AssertCorrectedHandlerVersion(typeof (OpenTypeHandler), openTypeHandler, HandlerRegistry
         .HandlerVersion + 1);
     var stdReferenceHandler = new StandardReferenceTypeHandler
         (ItemClassMetadata());
     AssertCorrectedHandlerVersion(typeof (StandardReferenceTypeHandler0), stdReferenceHandler
         , 0);
     AssertCorrectedHandlerVersion(typeof (StandardReferenceTypeHandler), stdReferenceHandler
         , 2);
     var primitiveMetadata = new PrimitiveTypeMetadata(Container(),
         openTypeHandler, 0, null);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler0), primitiveMetadata, 0);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler2), primitiveMetadata, 1);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler2), primitiveMetadata, 2);
     AssertPrimitiveHandlerDelegate(typeof (OpenTypeHandler), primitiveMetadata, HandlerRegistry
         .HandlerVersion);
     var arrayHandler = new ArrayHandler(openTypeHandler, false);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler0), arrayHandler, 0);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler1), arrayHandler, 1);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler3), arrayHandler, 2);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler3), arrayHandler, 3);
     AssertCorrectedHandlerVersion(typeof (ArrayHandler), arrayHandler, HandlerRegistry
         .HandlerVersion);
     ArrayHandler multidimensionalArrayHandler = new MultidimensionalArrayHandler(openTypeHandler
         , false);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler0), multidimensionalArrayHandler
         , 0);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 1);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 2);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler3), multidimensionalArrayHandler
         , 3);
     AssertCorrectedHandlerVersion(typeof (MultidimensionalArrayHandler), multidimensionalArrayHandler
         , HandlerRegistry.HandlerVersion);
 }
示例#3
0
 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;
 }
示例#4
0
		private void RegisterCompositeHandlerVersions()
		{
			RegisterHandlerVersion(new StandardReferenceTypeHandler(), 0, new StandardReferenceTypeHandler0
				());
			ArrayHandler arrayHandler = new ArrayHandler();
			RegisterHandlerVersion(arrayHandler, 0, new ArrayHandler0());
			RegisterHandlerVersion(arrayHandler, 1, new ArrayHandler1());
			RegisterHandlerVersion(arrayHandler, 3, new ArrayHandler3());
			RegisterHandlerVersion(arrayHandler, 5, new ArrayHandler5());
			MultidimensionalArrayHandler multidimensionalArrayHandler = new MultidimensionalArrayHandler
				();
			RegisterHandlerVersion(multidimensionalArrayHandler, 0, new MultidimensionalArrayHandler0
				());
			RegisterHandlerVersion(multidimensionalArrayHandler, 3, new MultidimensionalArrayHandler3
				());
		}