Пример #1
0
        public SwitchQueryStrategy(QueryStrategy defaultQueryStrategy, params ConditionalQueryStrategy[] conditionalQueryStrategies)
        {
            Check.NotNull(defaultQueryStrategy, "defaultQueryStrategy");

            ConditionalQueryStrategies = conditionalQueryStrategies;
            DefaultQueryStrategy       = defaultQueryStrategy;
        }
        public static IQueryStrategy OnCondition(this QueryStrategy queryStrategy, bool condition)
        {
            Check.NotNull(queryStrategy, "queryStrategy");

            if (condition)
            {
                return(queryStrategy);
            }

            var defaultQueryStrategy = new DefaultQueryStrategy();

            defaultQueryStrategy.QueryableRepository = queryStrategy.QueryableRepository;
            return(defaultQueryStrategy);
        }