28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using System.Linq.Expressions;
|
|
|
|
namespace ZeroFramework.DeviceCenter.Domain.Specifications.Builder
|
|
{
|
|
public static class OrderedBuilderExtensions
|
|
{
|
|
public static IOrderedSpecificationBuilder<T> ThenBy<T>(
|
|
this IOrderedSpecificationBuilder<T> orderedBuilder,
|
|
Expression<Func<T, object?>> orderExpression)
|
|
{
|
|
((List<(Expression<Func<T, object?>> OrderExpression, OrderTypeEnum OrderType)>)orderedBuilder.Specification.OrderExpressions)
|
|
.Add((orderExpression, OrderTypeEnum.ThenBy));
|
|
|
|
return orderedBuilder;
|
|
}
|
|
|
|
public static IOrderedSpecificationBuilder<T> ThenByDescending<T>(
|
|
this IOrderedSpecificationBuilder<T> orderedBuilder,
|
|
Expression<Func<T, object?>> orderExpression)
|
|
{
|
|
((List<(Expression<Func<T, object?>> OrderExpression, OrderTypeEnum OrderType)>)orderedBuilder.Specification.OrderExpressions)
|
|
.Add((orderExpression, OrderTypeEnum.ThenByDescending));
|
|
|
|
return orderedBuilder;
|
|
}
|
|
}
|
|
}
|