mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Added some tests for PagingSpecExtensions
Allow specials in missing Dropped ListSortDirection
This commit is contained in:
parent
d37c8c26c2
commit
f4dd6adc6a
12 changed files with 131 additions and 92 deletions
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq.Expressions;
|
||||
|
@ -10,39 +9,22 @@ namespace Marr.Data.QGen
|
|||
{
|
||||
public class SortColumn<T>
|
||||
{
|
||||
[Obsolete("Use ListSortDirection instead")]
|
||||
public SortColumn(Expression<Func<T, object>> sortExpression, SortDirection direction)
|
||||
{
|
||||
MemberExpression me = GetMemberExpression(sortExpression.Body);
|
||||
DeclaringType = me.Expression.Type;
|
||||
PropertyName = me.Member.Name;
|
||||
Direction = GetSortDirection(direction);
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
[Obsolete("Use ListSortDirection instead")]
|
||||
public SortColumn(Type declaringType, string propertyName, SortDirection direction)
|
||||
{
|
||||
DeclaringType = declaringType;
|
||||
PropertyName = propertyName;
|
||||
Direction = GetSortDirection(direction);
|
||||
}
|
||||
|
||||
public SortColumn(Expression<Func<T, object>> sortExpression, ListSortDirection direction)
|
||||
{
|
||||
MemberExpression me = GetMemberExpression(sortExpression.Body);
|
||||
DeclaringType = me.Expression.Type;
|
||||
PropertyName = me.Member.Name;
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
public SortColumn(Type declaringType, string propertyName, ListSortDirection direction)
|
||||
{
|
||||
DeclaringType = declaringType;
|
||||
PropertyName = propertyName;
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
public ListSortDirection Direction { get; private set; }
|
||||
public SortDirection Direction { get; private set; }
|
||||
public Type DeclaringType { get; private set; }
|
||||
public string PropertyName { get; private set; }
|
||||
|
||||
|
@ -58,13 +40,6 @@ namespace Marr.Data.QGen
|
|||
|
||||
return me;
|
||||
}
|
||||
|
||||
private ListSortDirection GetSortDirection(SortDirection direction)
|
||||
{
|
||||
if (direction == SortDirection.Desc) return ListSortDirection.Descending;
|
||||
|
||||
return ListSortDirection.Ascending;
|
||||
}
|
||||
}
|
||||
|
||||
public enum SortDirection
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue