mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
LINQ for paging missing episodes
This commit is contained in:
parent
a414a4663e
commit
d37c8c26c2
26 changed files with 318 additions and 57 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq.Expressions;
|
||||
|
@ -9,7 +10,24 @@ 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);
|
||||
}
|
||||
|
||||
[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;
|
||||
|
@ -17,14 +35,14 @@ namespace Marr.Data.QGen
|
|||
Direction = direction;
|
||||
}
|
||||
|
||||
public SortColumn(Type declaringType, string propertyName, SortDirection direction)
|
||||
public SortColumn(Type declaringType, string propertyName, ListSortDirection direction)
|
||||
{
|
||||
DeclaringType = declaringType;
|
||||
PropertyName = propertyName;
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
public SortDirection Direction { get; private set; }
|
||||
public ListSortDirection Direction { get; private set; }
|
||||
public Type DeclaringType { get; private set; }
|
||||
public string PropertyName { get; private set; }
|
||||
|
||||
|
@ -40,6 +58,13 @@ 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