Skip to content

Commit 500ee98

Browse files
Renamed the query options SortingPropertiesMapping to SortingProperties
1 parent 1e29fd8 commit 500ee98

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

src/DotNetToolkit.Repository.AdoNet/Internal/QueryBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ string EnsureTableAlias(string prefix)
398398

399399
if (string.IsNullOrEmpty(defaultSelect))
400400
{
401-
var sorting = options.SortingPropertiesMapping.ToDictionary(x => x.Key, x => x.Value);
401+
var sorting = options.SortingProperties.ToDictionary(x => x.Key, x => x.Value);
402402

403403
if (!sorting.Any())
404404
{

src/DotNetToolkit.Repository/Extensions/QueryableExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static IOrderedQueryable<T> ApplySortingOptions<T>([NotNull] this IQuerya
4545
var sorting = new Dictionary<string, SortOrder>();
4646

4747
if (options != null)
48-
sorting = options.SortingPropertiesMapping.ToDictionary(x => x.Key, x => x.Value);
48+
sorting = options.SortingProperties.ToDictionary(x => x.Key, x => x.Value);
4949

5050
// Sorts on the composite key by default if no sorting is provided
5151
if (!sorting.Any())

test/DotNetToolkit.Repository.Test/Tests/QueryOptionsTests.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,39 +53,39 @@ public void SortBy()
5353
{
5454
var options = new QueryOptions<Customer>();
5555

56-
Assert.Empty(((IQueryOptions<Customer>)options).SortingPropertiesMapping);
56+
Assert.Empty(((IQueryOptions<Customer>)options).SortingProperties);
5757

5858
options = options.OrderBy(x => x.Id);
5959

60-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
61-
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
62-
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
60+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
61+
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
62+
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
6363

6464
options = options.OrderBy("Id");
6565

66-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
67-
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
68-
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
66+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
67+
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
68+
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
6969
}
7070

7171
[Fact]
7272
public void SortByDescending()
7373
{
7474
var options = new QueryOptions<Customer>();
7575

76-
Assert.Empty(((IQueryOptions<Customer>)options).SortingPropertiesMapping);
76+
Assert.Empty(((IQueryOptions<Customer>)options).SortingProperties);
7777

7878
options = options.OrderByDescending(x => x.Id);
7979

80-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
81-
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
82-
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
80+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
81+
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
82+
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
8383

8484
options = options.OrderByDescending("Id");
8585

86-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
87-
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
88-
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
86+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
87+
Assert.Equal("Id", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
88+
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
8989
}
9090

9191
[Fact]
@@ -95,21 +95,21 @@ public void SortThenBy()
9595

9696
options = options.OrderBy(x => x.Id).OrderBy(x => x.Name);
9797

98-
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
99-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Key);
100-
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Value);
98+
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingProperties.Count);
99+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Key);
100+
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Value);
101101

102102
options = options.OrderBy("Id").OrderBy("Name");
103103

104-
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
105-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Key);
106-
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Value);
104+
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingProperties.Count);
105+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Key);
106+
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Value);
107107

108108
options = new QueryOptions<Customer>().OrderBy("Name").OrderByDescending("Name");
109109

110-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
111-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
112-
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
110+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
111+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
112+
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
113113
}
114114

115115
[Fact]
@@ -119,21 +119,21 @@ public void SortThenByDescending()
119119

120120
options = options.OrderByDescending(x => x.Id).OrderByDescending(x => x.Name);
121121

122-
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
123-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Key);
124-
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Value);
122+
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingProperties.Count);
123+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Key);
124+
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Value);
125125

126126
options = options.OrderByDescending("Id").OrderByDescending("Name");
127127

128-
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
129-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Key);
130-
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(1).Value);
128+
Assert.Equal(2, ((IQueryOptions<Customer>)options).SortingProperties.Count);
129+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Key);
130+
Assert.Equal(SortOrder.Descending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(1).Value);
131131

132132
options = new QueryOptions<Customer>().OrderByDescending("Name").OrderBy("Name");
133133

134-
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.Count);
135-
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Key);
136-
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingPropertiesMapping.ElementAt(0).Value);
134+
Assert.Equal(1, ((IQueryOptions<Customer>)options).SortingProperties.Count);
135+
Assert.Equal("Name", ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Key);
136+
Assert.Equal(SortOrder.Ascending, ((IQueryOptions<Customer>)options).SortingProperties.ElementAt(0).Value);
137137
}
138138

139139
[Fact]

0 commit comments

Comments
 (0)