| | 1 | | using Fluorite.Strainer.Models.Sorting.Terms; |
| | 2 | | using System.Linq.Expressions; |
| | 3 | |
|
| | 4 | | namespace Fluorite.Strainer.Services.Sorting; |
| | 5 | |
|
| | 6 | | public class CustomSortMethodBuilderWithName<TEntity> : CustomSortMethodBuilder<TEntity>, ICustomSortMethodBuilderWithNa |
| | 7 | | { |
| 11 | 8 | | public CustomSortMethodBuilderWithName(string name) |
| | 9 | | { |
| 11 | 10 | | Name = Guard.Against.NullOrWhiteSpace(name); |
| 11 | 11 | | } |
| | 12 | |
|
| 11 | 13 | | protected string Name { get; } |
| | 14 | |
|
| | 15 | | public ICustomSortMethodBuilderWithExpression<TEntity> HasFunction(Expression<Func<TEntity, object>> expression) |
| | 16 | | { |
| 5 | 17 | | Guard.Against.Null(expression); |
| | 18 | |
|
| 5 | 19 | | return new CustomSortMethodBuilderWithExpression<TEntity>(Name, expression); |
| | 20 | | } |
| | 21 | |
|
| | 22 | | public ICustomSortMethodBuilderWithExpression<TEntity> HasFunction( |
| | 23 | | Func<ISortTerm, Expression<Func<TEntity, object>>> sortTermExpression) |
| | 24 | | { |
| 1 | 25 | | Guard.Against.Null(sortTermExpression); |
| | 26 | |
|
| 1 | 27 | | return new CustomSortMethodBuilderWithExpression<TEntity>(Name, sortTermExpression); |
| | 28 | | } |
| | 29 | | } |