public static IQueryable <T> AddQueryStrategy <T>(this IQueryable <T> query, params IQueryStrategy[] strategies) where T : class
        {
            Check.NotNull(query, "query");
            Check.NotNull(strategies, "strategies");

            var singleRepository = new SingleQueryRepository <T>(query);

            var aggregateStrategy = new AggregateQueryStrategy(strategies);

            aggregateStrategy.QueryableRepository = singleRepository;

            return((IQueryable <T>)aggregateStrategy.GetQueryableEntities <T>(null));
        }
예제 #2
0
        public static IEnumerable <T> AddQueryStrategy <T>(this IEnumerable <T> enumerable, params IQueryStrategy[] strategies) where T : class
        {
            Check.NotNull(enumerable, "enumerable");
            Check.NotNull(strategies, "strategies");

            var singleRepository = new SingleQueryRepository <T>(enumerable.AsQueryable());

            var aggregateStrategy = new AggregateQueryStrategy(strategies);

            aggregateStrategy.QueryableRepository = singleRepository;

            return(aggregateStrategy.GetQueryableEntities <T>(null).AsEnumerable());
        }