moved sorting to base.

This commit is contained in:
David Lebée 2018-02-14 07:49:49 -06:00
parent b348bdfe90
commit 5808884a06
2 changed files with 46 additions and 46 deletions

View File

@ -34,52 +34,6 @@ namespace PoweredSoft.DynamicLinq.Fluent
return query;
}
public virtual QueryBuilder<T> OrderBy(string path)
{
Sorts.Clear();
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Ascending,
AppendSort = false
});
return this;
}
public virtual QueryBuilder<T> OrderByDescending(string path)
{
Sorts.Clear();
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Descending,
AppendSort = false
});
return this;
}
public virtual QueryBuilder<T> ThenBy(string path)
{
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Ascending,
AppendSort = true
});
return this;
}
public virtual QueryBuilder<T> ThenByDescending(string path)
{
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Descending,
AppendSort = true
});
return this;
}
protected virtual IQueryable<T> BuildSorts(IQueryable<T> query)
{
Sorts.ForEach(sort =>

View File

@ -84,5 +84,51 @@ namespace PoweredSoft.DynamicLinq.Fluent
public QueryBuilderBase Or(Action<QueryBuilderBase> subQuery)
=> SubQuery(subQuery, false);
public virtual QueryBuilderBase OrderBy(string path)
{
Sorts.Clear();
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Ascending,
AppendSort = false
});
return this;
}
public virtual QueryBuilderBase OrderByDescending(string path)
{
Sorts.Clear();
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Descending,
AppendSort = false
});
return this;
}
public virtual QueryBuilderBase ThenBy(string path)
{
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Ascending,
AppendSort = true
});
return this;
}
public virtual QueryBuilderBase ThenByDescending(string path)
{
Sorts.Add(new QueryBuilderSort
{
Path = path,
SortOrder = SortOrder.Descending,
AppendSort = true
});
return this;
}
}
}