Пример #1
0
        protected virtual IList GetResultList(IList results)
        {
            var resultCollections = new List <object>(resultCollectionGenericType.Count);

            for (int i = 0; i < criteriaQueries.Count; i++)
            {
                if (resultCollectionGenericType[i] == typeof(object))
                {
                    resultCollections.Add(new List <object>());
                }
                else
                {
                    resultCollections.Add(Activator.CreateInstance(typeof(List <>).MakeGenericType(resultCollectionGenericType[i])));
                }
            }

            for (int i = 0; i < loaders.Count; i++)
            {
                CriteriaLoader loader        = loaders[i];
                var            resultList    = loader.GetResultList((IList)results[i], parameters[i].ResultTransformer);
                var            criteriaIndex = loaderCriteriaMap[i];
                ArrayHelper.AddAll((IList)resultCollections[criteriaIndex], resultList);
            }

            if (resultTransformer != null)
            {
                for (int i = 0; i < results.Count; i++)
                {
                    resultCollections[i] = resultTransformer.TransformList((IList)resultCollections[i]);
                }
            }

            return(resultCollections);
        }
Пример #2
0
        protected virtual IList GetResultList(IList results)
        {
            for (int i = 0; i < loaders.Count; i++)
            {
                CriteriaLoader loader = loaders[i];
                results[i] = loader.GetResultList((IList)results[i], parameters[i].ResultTransformer);
                IList tmpResults;
                if (resultCollectionGenericType[i] == typeof(object))
                {
                    tmpResults = new ArrayList();
                }
                else
                {
                    tmpResults = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(resultCollectionGenericType[i]));
                }
                ArrayHelper.AddAll(tmpResults, (IList)results[i]);

                results[i] = tmpResults;
            }
            if (resultTransformer != null)
            {
                for (int i = 0; i < results.Count; i++)
                {
                    results[i] = resultTransformer.TransformList((IList)results[i]);
                }
            }
            return(results);
        }