From 5808884a06ab6bb4a2ac33eeb6d427cfae208477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Leb=C3=A9e?= Date: Wed, 14 Feb 2018 07:49:49 -0600 Subject: [PATCH] moved sorting to base. --- .../Fluent/QueryBuilder.cs | 46 ------------------- .../Fluent/QueryBuilderBase.cs | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/PoweredSoft.DynamicLinq/Fluent/QueryBuilder.cs b/PoweredSoft.DynamicLinq/Fluent/QueryBuilder.cs index 4b3d487..cb64aaa 100644 --- a/PoweredSoft.DynamicLinq/Fluent/QueryBuilder.cs +++ b/PoweredSoft.DynamicLinq/Fluent/QueryBuilder.cs @@ -34,52 +34,6 @@ namespace PoweredSoft.DynamicLinq.Fluent return query; } - public virtual QueryBuilder OrderBy(string path) - { - Sorts.Clear(); - Sorts.Add(new QueryBuilderSort - { - Path = path, - SortOrder = SortOrder.Ascending, - AppendSort = false - }); - return this; - } - - public virtual QueryBuilder OrderByDescending(string path) - { - Sorts.Clear(); - Sorts.Add(new QueryBuilderSort - { - Path = path, - SortOrder = SortOrder.Descending, - AppendSort = false - }); - return this; - } - - public virtual QueryBuilder ThenBy(string path) - { - Sorts.Add(new QueryBuilderSort - { - Path = path, - SortOrder = SortOrder.Ascending, - AppendSort = true - }); - return this; - } - - public virtual QueryBuilder ThenByDescending(string path) - { - Sorts.Add(new QueryBuilderSort - { - Path = path, - SortOrder = SortOrder.Descending, - AppendSort = true - }); - return this; - } - protected virtual IQueryable BuildSorts(IQueryable query) { Sorts.ForEach(sort => diff --git a/PoweredSoft.DynamicLinq/Fluent/QueryBuilderBase.cs b/PoweredSoft.DynamicLinq/Fluent/QueryBuilderBase.cs index f0092f2..b170c1b 100644 --- a/PoweredSoft.DynamicLinq/Fluent/QueryBuilderBase.cs +++ b/PoweredSoft.DynamicLinq/Fluent/QueryBuilderBase.cs @@ -84,5 +84,51 @@ namespace PoweredSoft.DynamicLinq.Fluent public QueryBuilderBase Or(Action 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; + } } }