Example #1
0
 public static ICollectionInitializer CreateBatchingCollectionInitializer(IQueryableCollection persister,
                                                                          int maxBatchSize,
                                                                          ISessionFactoryImplementor factory,
                                                                          IDictionary <string, IFilter> enabledFilters)
 {
     if (maxBatchSize > 1)
     {
         int[]    batchSizesToCreate = ArrayHelper.GetBatchSizes(maxBatchSize);
         Loader[] loadersToCreate    = new Loader[batchSizesToCreate.Length];
         for (int i = 0; i < batchSizesToCreate.Length; i++)
         {
             loadersToCreate[i] = new BasicCollectionLoader(persister, batchSizesToCreate[i], factory, enabledFilters);
         }
         return(new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate));
     }
     else
     {
         return(new BasicCollectionLoader(persister, factory, enabledFilters));
     }
 }
		public static ICollectionInitializer CreateBatchingCollectionInitializer(IQueryableCollection persister,
		                                                                         int maxBatchSize,
		                                                                         ISessionFactoryImplementor factory,
		                                                                         IDictionary<string, IFilter> enabledFilters)
		{
			if (maxBatchSize > 1)
			{
				int[] batchSizesToCreate = ArrayHelper.GetBatchSizes(maxBatchSize);
				Loader[] loadersToCreate = new Loader[batchSizesToCreate.Length];
				for (int i = 0; i < batchSizesToCreate.Length; i++)
				{
					loadersToCreate[i] = new BasicCollectionLoader(persister, batchSizesToCreate[i], factory, enabledFilters);
				}
				return new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate);
			}
			else
			{
				return new BasicCollectionLoader(persister, factory, enabledFilters);
			}
		}