public TBuilder SortWith <TBaseRequest>(ISorter <TBaseRequest, TEntity> sorter)
        {
            if (!typeof(TBaseRequest).IsAssignableFrom(typeof(TRequest)))
            {
                throw new ContravarianceException(nameof(SortWith), typeof(TBaseRequest), typeof(TRequest));
            }

            Sorter = InstanceSorterFactory.From(sorter);

            return((TBuilder)this);
        }
        public TBuilder SortWith(
            Action <SortBuilder <TRequest, TEntity> > build)
        {
            var builder = new SortBuilder <TRequest, TEntity>();

            build(builder);

            Sorter = builder.Build();

            return((TBuilder)this);
        }
        public TBuilder SortUsing <TBaseRequest>(
            Func <TBaseRequest, IQueryable <TEntity>, IOrderedQueryable <TEntity> > sortFunc)
        {
            if (!typeof(TBaseRequest).IsAssignableFrom(typeof(TRequest)))
            {
                throw new ContravarianceException(nameof(SortUsing), typeof(TBaseRequest), typeof(TRequest));
            }

            Sorter = FunctionSorterFactory.From(sortFunc);

            return((TBuilder)this);
        }
        public TBuilder SortWith <TSorter, TBaseRequest>()
            where TSorter : ISorter <TBaseRequest, TEntity>
        {
            if (!typeof(TBaseRequest).IsAssignableFrom(typeof(TRequest)))
            {
                throw new ContravarianceException(nameof(SortWith), typeof(TBaseRequest), typeof(TRequest));
            }

            Sorter = TypeSorterFactory.From <TSorter, TBaseRequest, TEntity>();

            return((TBuilder)this);
        }
Пример #5
0
 internal void SetEntitySorter <TEntity>(ISorterFactory sorter)
     where TEntity : class
 {
     _entitySorters[typeof(TEntity)] = sorter;
 }
 internal TBuilder SetSorter(ISorterFactory sorterFactory)
 {
     Sorter = sorterFactory;
     return((TBuilder)this);
 }
Пример #7
0
 public NameController(ISorterFactory sortFactory)
 {
     _sortFactory = sortFactory;
 }