From 5b5397c407e8770325463cdbb4f75b38b88e238a Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 30 Jan 2025 22:34:57 +0000 Subject: [PATCH] Simplified Expression Structure (#7973) * Simplified Expression Structure * Fixed snapshots * Fixed snapshots * Fixed snapshots --- .../Expressions/ExpressionHelpers.cs | 4 +- .../PagingHelperIntegrationTests.cs | 23 +- ...gHelperTests.BatchPaging_First_5_NET8_0.md | 153 ++ ...ngHelperTests.BatchPaging_Last_5_NET8_0.md | 153 ++ ...perTests.Paging_Empty_PagingArgs_NET8_0.md | 1236 +++++++++++++++++ ...gHelperTests.Paging_First_5_After_Id_13.md | 8 +- ...Tests.Paging_First_5_After_Id_13_NET8_0.md | 101 ++ ...HelperTests.Paging_First_5_Before_Id_96.md | 8 +- ...ests.Paging_First_5_Before_Id_96_NET8_0.md | 101 ++ ...PagingHelperTests.Paging_First_5_NET8_0.md | 98 ++ ...nPagingHelperTests.Paging_Last_5_NET8_0.md | 98 ++ ...ests.Paging_Fetch_First_2_Items_Between.md | 2 +- ...Tests.Paging_Fetch_Last_2_Items_Between.md | 2 +- ...ests.Paging_Next_2_With_Default_Sorting.md | 2 +- ...onTests.Paging_Next_2_With_User_Sorting.md | 2 +- .../Data.PostgreSQL.Tests/IntegrationTests.cs | 4 + ...s_First_2_Name_Desc_Brand_Name__net_8_0.md | 99 ++ ...And_Products_First_2_Name_Desc__net_8_0.md | 80 ++ ...s_First_2_And_Products_First_2__net_8_0.md | 80 ++ ...tionTests.Query_Brands_First_2__net_8_0.md | 33 + .../IntegrationTests.Query_Brands__net_8_0.md | 65 + ...egrationTests.Query_Node_Brand__net_8_0.md | 24 + ...rationTests.Query_Node_Product__net_8_0.md | 24 + ...sts.GetDefaultPage_With_Deep_SecondPage.md | 8 +- ...tPage_With_Nullable_Fallback_SecondPage.md | 8 +- ...GetDefaultPage_With_Nullable_SecondPage.md | 8 +- ...gHelperTests.GetSecondPage_With_2_Items.md | 8 +- ...gHelperTests.Paging_First_5_After_Id_13.md | 8 +- ...HelperTests.Paging_First_5_Before_Id_96.md | 8 +- 29 files changed, 2403 insertions(+), 45 deletions(-) create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_First_5_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_Last_5_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Empty_PagingArgs_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_NET8_0.md create mode 100644 src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Last_5_NET8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc_Brand_Name__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Brand__net_8_0.md create mode 100644 src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Product__net_8_0.md diff --git a/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs b/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs index 494b389fc4a..e98e1dfb2c5 100644 --- a/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs +++ b/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs @@ -378,9 +378,9 @@ private static Expression CreateParameter(object? value, Type type) return converter(value); } - private static Expression CreateAndConvertParameter(object value) + private static Expression CreateAndConvertParameter(T value) { - Expression> lambda = () => (T)value; + Expression> lambda = () => value; return lambda.Body; } diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperIntegrationTests.cs b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperIntegrationTests.cs index 9969b7edc6f..8a40c174b76 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperIntegrationTests.cs +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/PagingHelperIntegrationTests.cs @@ -29,7 +29,7 @@ public async Task Paging_Empty_PagingArgs() var result = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(pagingArgs); // Assert - await Snapshot.Create() + await CreateSnapshot() .AddQueries(queries) .Add( new @@ -61,7 +61,7 @@ public async Task Paging_First_5() var result = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(pagingArgs); // Assert - await Snapshot.Create() + await CreateSnapshot() .AddQueries(queries) .Add( new @@ -97,7 +97,7 @@ public async Task Paging_First_5_After_Id_13() var result = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(pagingArgs); // Assert - await Snapshot.Create() + await CreateSnapshot() .AddQueries(queries) .Add( new @@ -129,7 +129,7 @@ public async Task Paging_Last_5() var result = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(pagingArgs); // Assert - await Snapshot.Create() + await CreateSnapshot() .AddQueries(queries) .Add( new @@ -165,7 +165,7 @@ public async Task Paging_First_5_Before_Id_96() var result = await context.Brands.OrderBy(t => t.Name).ThenBy(t => t.Id).ToPageAsync(pagingArgs); // Assert - await Snapshot.Create() + await CreateSnapshot() .AddQueries(queries) .Add( new @@ -186,7 +186,7 @@ public async Task BatchPaging_First_5() { // Arrange #if NET8_0 - var snapshot = Snapshot.Create(); + var snapshot = CreateSnapshot(); #else var snapshot = Snapshot.Create("NET9_0"); #endif @@ -229,7 +229,7 @@ public async Task BatchPaging_Last_5() { // Arrange #if NET8_0 - var snapshot = Snapshot.Create(); + var snapshot = CreateSnapshot(); #else var snapshot = Snapshot.Create("NET9_0"); #endif @@ -388,6 +388,15 @@ protected override async Task>> LoadBatch .ToBatchPageAsync(t => t.BrandId, pagingArgs, cancellationToken); } } + + private static Snapshot CreateSnapshot() + { +#if NET9_0_OR_GREATER + return Snapshot.Create(); +#else + return Snapshot.Create("NET8_0"); +#endif + } } file static class Extensions diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_First_5_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_First_5_NET8_0.md new file mode 100644 index 00000000000..19a899208b2 --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_First_5_NET8_0.md @@ -0,0 +1,153 @@ +# BatchPaging_First_5 + +## 1 + +```json +{ + "First": "UHJvZHVjdCAwLTA6MQ==", + "Last": "UHJvZHVjdCAwLTE6Mg==", + "Items": [ + { + "Id": 1, + "Name": "Product 0-0", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 1, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 2, + "Name": "Product 0-1", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 1, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## 2 + +```json +{ + "First": "UHJvZHVjdCAxLTA6MTAx", + "Last": "UHJvZHVjdCAxLTE6MTAy", + "Items": [ + { + "Id": 101, + "Name": "Product 1-0", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 2, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 102, + "Name": "Product 1-1", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 2, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## 3 + +```json +{ + "First": "UHJvZHVjdCAyLTA6MjAx", + "Last": "UHJvZHVjdCAyLTE6MjAy", + "Items": [ + { + "Id": 201, + "Name": "Product 2-0", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 3, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 202, + "Name": "Product 2-1", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 3, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## SQL 0 + +```sql +SELECT t."BrandId", t0."Id", t0."AvailableStock", t0."BrandId", t0."Description", t0."ImageFileName", t0."MaxStockThreshold", t0."Name", t0."OnReorder", t0."Price", t0."RestockThreshold", t0."TypeId" +FROM ( + SELECT p."BrandId" + FROM "Products" AS p + WHERE p."BrandId" IN (1, 2, 3) + GROUP BY p."BrandId" +) AS t +LEFT JOIN ( + SELECT t1."Id", t1."AvailableStock", t1."BrandId", t1."Description", t1."ImageFileName", t1."MaxStockThreshold", t1."Name", t1."OnReorder", t1."Price", t1."RestockThreshold", t1."TypeId" + FROM ( + SELECT p0."Id", p0."AvailableStock", p0."BrandId", p0."Description", p0."ImageFileName", p0."MaxStockThreshold", p0."Name", p0."OnReorder", p0."Price", p0."RestockThreshold", p0."TypeId", ROW_NUMBER() OVER(PARTITION BY p0."BrandId" ORDER BY p0."Name", p0."Id") AS row + FROM "Products" AS p0 + WHERE p0."BrandId" = 1 OR p0."BrandId" = 2 OR p0."BrandId" = 3 + ) AS t1 + WHERE t1.row <= 3 +) AS t0 ON t."BrandId" = t0."BrandId" +ORDER BY t."BrandId", t0."BrandId", t0."Name", t0."Id" +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].Where(t => (((t.BrandId == 1) OrElse (t.BrandId == 2)) OrElse (t.BrandId == 3))).GroupBy(k => k.BrandId).Select(g => new Group`2() {Key = g.Key, Items = g.OrderBy(p => p.Name).ThenBy(p => p.Id).Take(3).ToList()}) +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_Last_5_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_Last_5_NET8_0.md new file mode 100644 index 00000000000..1ff0e6d16a4 --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.BatchPaging_Last_5_NET8_0.md @@ -0,0 +1,153 @@ +# BatchPaging_Last_5 + +## 1 + +```json +{ + "First": "MTAw", + "Last": "OTk=", + "Items": [ + { + "Id": 100, + "Name": "Product 0-99", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 1, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 99, + "Name": "Product 0-98", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 1, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## 2 + +```json +{ + "First": "MjAw", + "Last": "MTk5", + "Items": [ + { + "Id": 200, + "Name": "Product 1-99", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 2, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 199, + "Name": "Product 1-98", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 2, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## 3 + +```json +{ + "First": "MzAw", + "Last": "Mjk5", + "Items": [ + { + "Id": 300, + "Name": "Product 2-99", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 3, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + }, + { + "Id": 299, + "Name": "Product 2-98", + "Description": null, + "Price": 0.0, + "ImageFileName": null, + "TypeId": 1, + "Type": null, + "BrandId": 3, + "Brand": null, + "AvailableStock": 0, + "RestockThreshold": 0, + "MaxStockThreshold": 0, + "OnReorder": false + } + ] +} +``` + +## SQL 0 + +```sql +SELECT t."BrandId", t0."Id", t0."AvailableStock", t0."BrandId", t0."Description", t0."ImageFileName", t0."MaxStockThreshold", t0."Name", t0."OnReorder", t0."Price", t0."RestockThreshold", t0."TypeId" +FROM ( + SELECT p."BrandId" + FROM "Products" AS p + WHERE p."BrandId" IN (1, 2, 3) + GROUP BY p."BrandId" +) AS t +LEFT JOIN ( + SELECT t1."Id", t1."AvailableStock", t1."BrandId", t1."Description", t1."ImageFileName", t1."MaxStockThreshold", t1."Name", t1."OnReorder", t1."Price", t1."RestockThreshold", t1."TypeId" + FROM ( + SELECT p0."Id", p0."AvailableStock", p0."BrandId", p0."Description", p0."ImageFileName", p0."MaxStockThreshold", p0."Name", p0."OnReorder", p0."Price", p0."RestockThreshold", p0."TypeId", ROW_NUMBER() OVER(PARTITION BY p0."BrandId" ORDER BY p0."Id" DESC) AS row + FROM "Products" AS p0 + WHERE p0."BrandId" = 1 OR p0."BrandId" = 2 OR p0."BrandId" = 3 + ) AS t1 + WHERE t1.row <= 3 +) AS t0 ON t."BrandId" = t0."BrandId" +ORDER BY t."BrandId", t0."BrandId", t0."Id" DESC +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].Where(t => (((t.BrandId == 1) OrElse (t.BrandId == 2)) OrElse (t.BrandId == 3))).GroupBy(k => k.BrandId).Select(g => new Group`2() {Key = g.Key, Items = g.OrderByDescending(p => p.Id).Take(3).ToList()}) +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Empty_PagingArgs_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Empty_PagingArgs_NET8_0.md new file mode 100644 index 00000000000..e6e8cfb64fe --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Empty_PagingArgs_NET8_0.md @@ -0,0 +1,1236 @@ +# Paging_Empty_PagingArgs + +## SQL 0 + +```sql +SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id) +``` + +## Result 3 + +```json +{ + "HasNextPage": false, + "HasPreviousPage": false, + "First": 1, + "FirstCursor": "QnJhbmRcOjA6MQ==", + "Last": 100, + "LastCursor": "QnJhbmRcOjk5OjEwMA==" +} +``` + +## Result 4 + +```json +[ + { + "Id": 1, + "Name": "Brand:0", + "DisplayName": "BrandDisplay0", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country0" + } + } + }, + { + "Id": 2, + "Name": "Brand:1", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country1" + } + } + }, + { + "Id": 11, + "Name": "Brand:10", + "DisplayName": "BrandDisplay10", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country10" + } + } + }, + { + "Id": 12, + "Name": "Brand:11", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country11" + } + } + }, + { + "Id": 13, + "Name": "Brand:12", + "DisplayName": "BrandDisplay12", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country12" + } + } + }, + { + "Id": 14, + "Name": "Brand:13", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country13" + } + } + }, + { + "Id": 15, + "Name": "Brand:14", + "DisplayName": "BrandDisplay14", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country14" + } + } + }, + { + "Id": 16, + "Name": "Brand:15", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country15" + } + } + }, + { + "Id": 17, + "Name": "Brand:16", + "DisplayName": "BrandDisplay16", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country16" + } + } + }, + { + "Id": 18, + "Name": "Brand:17", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country17" + } + } + }, + { + "Id": 19, + "Name": "Brand:18", + "DisplayName": "BrandDisplay18", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country18" + } + } + }, + { + "Id": 20, + "Name": "Brand:19", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country19" + } + } + }, + { + "Id": 3, + "Name": "Brand:2", + "DisplayName": "BrandDisplay2", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country2" + } + } + }, + { + "Id": 21, + "Name": "Brand:20", + "DisplayName": "BrandDisplay20", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country20" + } + } + }, + { + "Id": 22, + "Name": "Brand:21", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country21" + } + } + }, + { + "Id": 23, + "Name": "Brand:22", + "DisplayName": "BrandDisplay22", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country22" + } + } + }, + { + "Id": 24, + "Name": "Brand:23", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country23" + } + } + }, + { + "Id": 25, + "Name": "Brand:24", + "DisplayName": "BrandDisplay24", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country24" + } + } + }, + { + "Id": 26, + "Name": "Brand:25", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country25" + } + } + }, + { + "Id": 27, + "Name": "Brand:26", + "DisplayName": "BrandDisplay26", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country26" + } + } + }, + { + "Id": 28, + "Name": "Brand:27", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country27" + } + } + }, + { + "Id": 29, + "Name": "Brand:28", + "DisplayName": "BrandDisplay28", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country28" + } + } + }, + { + "Id": 30, + "Name": "Brand:29", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country29" + } + } + }, + { + "Id": 4, + "Name": "Brand:3", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country3" + } + } + }, + { + "Id": 31, + "Name": "Brand:30", + "DisplayName": "BrandDisplay30", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country30" + } + } + }, + { + "Id": 32, + "Name": "Brand:31", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country31" + } + } + }, + { + "Id": 33, + "Name": "Brand:32", + "DisplayName": "BrandDisplay32", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country32" + } + } + }, + { + "Id": 34, + "Name": "Brand:33", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country33" + } + } + }, + { + "Id": 35, + "Name": "Brand:34", + "DisplayName": "BrandDisplay34", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country34" + } + } + }, + { + "Id": 36, + "Name": "Brand:35", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country35" + } + } + }, + { + "Id": 37, + "Name": "Brand:36", + "DisplayName": "BrandDisplay36", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country36" + } + } + }, + { + "Id": 38, + "Name": "Brand:37", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country37" + } + } + }, + { + "Id": 39, + "Name": "Brand:38", + "DisplayName": "BrandDisplay38", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country38" + } + } + }, + { + "Id": 40, + "Name": "Brand:39", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country39" + } + } + }, + { + "Id": 5, + "Name": "Brand:4", + "DisplayName": "BrandDisplay4", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country4" + } + } + }, + { + "Id": 41, + "Name": "Brand:40", + "DisplayName": "BrandDisplay40", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country40" + } + } + }, + { + "Id": 42, + "Name": "Brand:41", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country41" + } + } + }, + { + "Id": 43, + "Name": "Brand:42", + "DisplayName": "BrandDisplay42", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country42" + } + } + }, + { + "Id": 44, + "Name": "Brand:43", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country43" + } + } + }, + { + "Id": 45, + "Name": "Brand:44", + "DisplayName": "BrandDisplay44", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country44" + } + } + }, + { + "Id": 46, + "Name": "Brand:45", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country45" + } + } + }, + { + "Id": 47, + "Name": "Brand:46", + "DisplayName": "BrandDisplay46", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country46" + } + } + }, + { + "Id": 48, + "Name": "Brand:47", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country47" + } + } + }, + { + "Id": 49, + "Name": "Brand:48", + "DisplayName": "BrandDisplay48", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country48" + } + } + }, + { + "Id": 50, + "Name": "Brand:49", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country49" + } + } + }, + { + "Id": 6, + "Name": "Brand:5", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country5" + } + } + }, + { + "Id": 51, + "Name": "Brand:50", + "DisplayName": "BrandDisplay50", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country50" + } + } + }, + { + "Id": 52, + "Name": "Brand:51", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country51" + } + } + }, + { + "Id": 53, + "Name": "Brand:52", + "DisplayName": "BrandDisplay52", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country52" + } + } + }, + { + "Id": 54, + "Name": "Brand:53", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country53" + } + } + }, + { + "Id": 55, + "Name": "Brand:54", + "DisplayName": "BrandDisplay54", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country54" + } + } + }, + { + "Id": 56, + "Name": "Brand:55", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country55" + } + } + }, + { + "Id": 57, + "Name": "Brand:56", + "DisplayName": "BrandDisplay56", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country56" + } + } + }, + { + "Id": 58, + "Name": "Brand:57", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country57" + } + } + }, + { + "Id": 59, + "Name": "Brand:58", + "DisplayName": "BrandDisplay58", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country58" + } + } + }, + { + "Id": 60, + "Name": "Brand:59", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country59" + } + } + }, + { + "Id": 7, + "Name": "Brand:6", + "DisplayName": "BrandDisplay6", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country6" + } + } + }, + { + "Id": 61, + "Name": "Brand:60", + "DisplayName": "BrandDisplay60", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country60" + } + } + }, + { + "Id": 62, + "Name": "Brand:61", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country61" + } + } + }, + { + "Id": 63, + "Name": "Brand:62", + "DisplayName": "BrandDisplay62", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country62" + } + } + }, + { + "Id": 64, + "Name": "Brand:63", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country63" + } + } + }, + { + "Id": 65, + "Name": "Brand:64", + "DisplayName": "BrandDisplay64", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country64" + } + } + }, + { + "Id": 66, + "Name": "Brand:65", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country65" + } + } + }, + { + "Id": 67, + "Name": "Brand:66", + "DisplayName": "BrandDisplay66", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country66" + } + } + }, + { + "Id": 68, + "Name": "Brand:67", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country67" + } + } + }, + { + "Id": 69, + "Name": "Brand:68", + "DisplayName": "BrandDisplay68", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country68" + } + } + }, + { + "Id": 70, + "Name": "Brand:69", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country69" + } + } + }, + { + "Id": 8, + "Name": "Brand:7", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country7" + } + } + }, + { + "Id": 71, + "Name": "Brand:70", + "DisplayName": "BrandDisplay70", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country70" + } + } + }, + { + "Id": 72, + "Name": "Brand:71", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country71" + } + } + }, + { + "Id": 73, + "Name": "Brand:72", + "DisplayName": "BrandDisplay72", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country72" + } + } + }, + { + "Id": 74, + "Name": "Brand:73", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country73" + } + } + }, + { + "Id": 75, + "Name": "Brand:74", + "DisplayName": "BrandDisplay74", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country74" + } + } + }, + { + "Id": 76, + "Name": "Brand:75", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country75" + } + } + }, + { + "Id": 77, + "Name": "Brand:76", + "DisplayName": "BrandDisplay76", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country76" + } + } + }, + { + "Id": 78, + "Name": "Brand:77", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country77" + } + } + }, + { + "Id": 79, + "Name": "Brand:78", + "DisplayName": "BrandDisplay78", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country78" + } + } + }, + { + "Id": 80, + "Name": "Brand:79", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country79" + } + } + }, + { + "Id": 9, + "Name": "Brand:8", + "DisplayName": "BrandDisplay8", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country8" + } + } + }, + { + "Id": 81, + "Name": "Brand:80", + "DisplayName": "BrandDisplay80", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country80" + } + } + }, + { + "Id": 82, + "Name": "Brand:81", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country81" + } + } + }, + { + "Id": 83, + "Name": "Brand:82", + "DisplayName": "BrandDisplay82", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country82" + } + } + }, + { + "Id": 84, + "Name": "Brand:83", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country83" + } + } + }, + { + "Id": 85, + "Name": "Brand:84", + "DisplayName": "BrandDisplay84", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country84" + } + } + }, + { + "Id": 86, + "Name": "Brand:85", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country85" + } + } + }, + { + "Id": 87, + "Name": "Brand:86", + "DisplayName": "BrandDisplay86", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country86" + } + } + }, + { + "Id": 88, + "Name": "Brand:87", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country87" + } + } + }, + { + "Id": 89, + "Name": "Brand:88", + "DisplayName": "BrandDisplay88", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country88" + } + } + }, + { + "Id": 90, + "Name": "Brand:89", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country89" + } + } + }, + { + "Id": 10, + "Name": "Brand:9", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country9" + } + } + }, + { + "Id": 91, + "Name": "Brand:90", + "DisplayName": "BrandDisplay90", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country90" + } + } + }, + { + "Id": 92, + "Name": "Brand:91", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country91" + } + } + }, + { + "Id": 93, + "Name": "Brand:92", + "DisplayName": "BrandDisplay92", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country92" + } + } + }, + { + "Id": 94, + "Name": "Brand:93", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country93" + } + } + }, + { + "Id": 95, + "Name": "Brand:94", + "DisplayName": "BrandDisplay94", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country94" + } + } + }, + { + "Id": 96, + "Name": "Brand:95", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country95" + } + } + }, + { + "Id": 97, + "Name": "Brand:96", + "DisplayName": "BrandDisplay96", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country96" + } + } + }, + { + "Id": 98, + "Name": "Brand:97", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country97" + } + } + }, + { + "Id": 99, + "Name": "Brand:98", + "DisplayName": "BrandDisplay98", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country98" + } + } + }, + { + "Id": 100, + "Name": "Brand:99", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country99" + } + } + } +] +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md index ff7c5c8d931..57afb399be8 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand12' --- @__p_1='13' +-- @__value_0='Brand12' +-- @__value_1='13' -- @__p_2='6' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" > @__p_0 OR (b."Name" = @__p_0 AND b."Id" > @__p_1) +WHERE b."Name" > @__value_0 OR (b."Name" = @__value_0 AND b."Id" > @__value_1) ORDER BY b."Name", b."Id" LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(6) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(6) ``` ## Result 3 diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13_NET8_0.md new file mode 100644 index 00000000000..57afb399be8 --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13_NET8_0.md @@ -0,0 +1,101 @@ +# Paging_First_5_After_Id_13 + +## SQL 0 + +```sql +-- @__value_0='Brand12' +-- @__value_1='13' +-- @__p_2='6' +SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" +FROM "Brands" AS b +WHERE b."Name" > @__value_0 OR (b."Name" = @__value_0 AND b."Id" > @__value_1) +ORDER BY b."Name", b."Id" +LIMIT @__p_2 +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(6) +``` + +## Result 3 + +```json +{ + "HasNextPage": true, + "HasPreviousPage": true, + "First": 14, + "FirstCursor": "QnJhbmRcOjEzOjE0", + "Last": 18, + "LastCursor": "QnJhbmRcOjE3OjE4" +} +``` + +## Result 4 + +```json +[ + { + "Id": 14, + "Name": "Brand:13", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country13" + } + } + }, + { + "Id": 15, + "Name": "Brand:14", + "DisplayName": "BrandDisplay14", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country14" + } + } + }, + { + "Id": 16, + "Name": "Brand:15", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country15" + } + } + }, + { + "Id": 17, + "Name": "Brand:16", + "DisplayName": "BrandDisplay16", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country16" + } + } + }, + { + "Id": 18, + "Name": "Brand:17", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country17" + } + } + } +] +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md index 66ad9cab02a..fdff316caee 100644 --- a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand95' --- @__p_1='96' +-- @__value_0='Brand95' +-- @__value_1='96' -- @__p_2='6' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" < @__p_0 OR (b."Name" = @__p_0 AND b."Id" < @__p_1) +WHERE b."Name" < @__value_0 OR (b."Name" = @__value_0 AND b."Id" < @__value_1) ORDER BY b."Name" DESC, b."Id" DESC LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) < 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) < 0)))).Reverse().Take(6) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) < 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) < 0)))).Reverse().Take(6) ``` ## Result 3 diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96_NET8_0.md new file mode 100644 index 00000000000..fdff316caee --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96_NET8_0.md @@ -0,0 +1,101 @@ +# Paging_First_5_Before_Id_96 + +## SQL 0 + +```sql +-- @__value_0='Brand95' +-- @__value_1='96' +-- @__p_2='6' +SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" +FROM "Brands" AS b +WHERE b."Name" < @__value_0 OR (b."Name" = @__value_0 AND b."Id" < @__value_1) +ORDER BY b."Name" DESC, b."Id" DESC +LIMIT @__p_2 +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) < 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) < 0)))).Reverse().Take(6) +``` + +## Result 3 + +```json +{ + "HasNextPage": true, + "HasPreviousPage": true, + "First": 92, + "FirstCursor": "QnJhbmRcOjkxOjky", + "Last": 96, + "LastCursor": "QnJhbmRcOjk1Ojk2" +} +``` + +## Result 4 + +```json +[ + { + "Id": 92, + "Name": "Brand:91", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country91" + } + } + }, + { + "Id": 93, + "Name": "Brand:92", + "DisplayName": "BrandDisplay92", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country92" + } + } + }, + { + "Id": 94, + "Name": "Brand:93", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country93" + } + } + }, + { + "Id": 95, + "Name": "Brand:94", + "DisplayName": "BrandDisplay94", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country94" + } + } + }, + { + "Id": 96, + "Name": "Brand:95", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country95" + } + } + } +] +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_NET8_0.md new file mode 100644 index 00000000000..84fbabb9dca --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_NET8_0.md @@ -0,0 +1,98 @@ +# Paging_First_5 + +## SQL 0 + +```sql +-- @__p_0='6' +SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Take(6) +``` + +## Result 3 + +```json +{ + "HasNextPage": true, + "HasPreviousPage": false, + "First": 1, + "FirstCursor": "QnJhbmRcOjA6MQ==", + "Last": 13, + "LastCursor": "QnJhbmRcOjEyOjEz" +} +``` + +## Result 4 + +```json +[ + { + "Id": 1, + "Name": "Brand:0", + "DisplayName": "BrandDisplay0", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country0" + } + } + }, + { + "Id": 2, + "Name": "Brand:1", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country1" + } + } + }, + { + "Id": 11, + "Name": "Brand:10", + "DisplayName": "BrandDisplay10", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country10" + } + } + }, + { + "Id": 12, + "Name": "Brand:11", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country11" + } + } + }, + { + "Id": 13, + "Name": "Brand:12", + "DisplayName": "BrandDisplay12", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country12" + } + } + } +] +``` + diff --git a/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Last_5_NET8_0.md b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Last_5_NET8_0.md new file mode 100644 index 00000000000..8b04e57e616 --- /dev/null +++ b/src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_Last_5_NET8_0.md @@ -0,0 +1,98 @@ +# Paging_Last_5 + +## SQL 0 + +```sql +-- @__p_0='6' +SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" +FROM "Brands" AS b +ORDER BY b."Name" DESC, b."Id" DESC +LIMIT @__p_0 +``` + +## Expression 0 + +```text +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Reverse().Take(6) +``` + +## Result 3 + +```json +{ + "HasNextPage": false, + "HasPreviousPage": true, + "First": 96, + "FirstCursor": "QnJhbmRcOjk1Ojk2", + "Last": 100, + "LastCursor": "QnJhbmRcOjk5OjEwMA==" +} +``` + +## Result 4 + +```json +[ + { + "Id": 96, + "Name": "Brand:95", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country95" + } + } + }, + { + "Id": 97, + "Name": "Brand:96", + "DisplayName": "BrandDisplay96", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country96" + } + } + }, + { + "Id": 98, + "Name": "Brand:97", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country97" + } + } + }, + { + "Id": 99, + "Name": "Brand:98", + "DisplayName": "BrandDisplay98", + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country98" + } + } + }, + { + "Id": 100, + "Name": "Brand:99", + "DisplayName": null, + "AlwaysNull": null, + "Products": [], + "BrandDetails": { + "Country": { + "Name": "Country99" + } + } + } +] +``` + diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_First_2_Items_Between.md b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_First_2_Items_Between.md index 4c7aa752c04..b03a878a308 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_First_2_Items_Between.md +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_First_2_Items_Between.md @@ -21,7 +21,7 @@ } }, "extensions": { - "sql": "-- @__p_0='1'\n-- @__p_1='4'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__p_0 AND b.\"Id\" < @__p_1\nORDER BY b.\"Id\"\nLIMIT @__p_2" + "sql": "-- @__value_0='1'\n-- @__value_1='4'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__value_0 AND b.\"Id\" < @__value_1\nORDER BY b.\"Id\"\nLIMIT @__p_2" } } ``` diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_Last_2_Items_Between.md b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_Last_2_Items_Between.md index ba4bc537766..f0a94bd8c55 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_Last_2_Items_Between.md +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Fetch_Last_2_Items_Between.md @@ -21,7 +21,7 @@ } }, "extensions": { - "sql": "-- @__p_0='97'\n-- @__p_1='100'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__p_0 AND b.\"Id\" < @__p_1\nORDER BY b.\"Id\" DESC\nLIMIT @__p_2" + "sql": "-- @__value_0='97'\n-- @__value_1='100'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__value_0 AND b.\"Id\" < @__value_1\nORDER BY b.\"Id\" DESC\nLIMIT @__p_2" } } ``` diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_Default_Sorting.md b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_Default_Sorting.md index f1d44cca851..98f382d7ee8 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_Default_Sorting.md +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_Default_Sorting.md @@ -18,7 +18,7 @@ } }, "extensions": { - "sql": "-- @__p_0='10'\n-- @__p_1='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__p_0\nORDER BY b.\"Id\"\nLIMIT @__p_1" + "sql": "-- @__value_0='10'\n-- @__p_1='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Id\" > @__value_0\nORDER BY b.\"Id\"\nLIMIT @__p_1" } } ``` diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_User_Sorting.md b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_User_Sorting.md index 3a1ae314acd..1396ee2f689 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_User_Sorting.md +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/__snapshots__/IntegrationTests.Paging_Next_2_With_User_Sorting.md @@ -18,7 +18,7 @@ } }, "extensions": { - "sql": "-- @__p_0='Brand17'\n-- @__p_1='18'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Name\" > @__p_0 OR (b.\"Name\" = @__p_0 AND b.\"Id\" > @__p_1)\nORDER BY b.\"Name\", b.\"Id\"\nLIMIT @__p_2" + "sql": "-- @__value_0='Brand17'\n-- @__value_1='18'\n-- @__p_2='3'\nSELECT b.\"Id\", b.\"AlwaysNull\", b.\"DisplayName\", b.\"Name\", b.\"BrandDetails_Country_Name\"\nFROM \"Brands\" AS b\nWHERE b.\"Name\" > @__value_0 OR (b.\"Name\" = @__value_0 AND b.\"Id\" > @__value_1)\nORDER BY b.\"Name\", b.\"Id\"\nLIMIT @__p_2" } } ``` diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IntegrationTests.cs b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IntegrationTests.cs index ff68971c96b..44311014459 100644 --- a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/IntegrationTests.cs @@ -257,7 +257,11 @@ private static void MatchSnapshot( IExecutionResult result, TestQueryInterceptor queryInterceptor) { +#if NET9_0_OR_GREATER var snapshot = Snapshot.Create(); +#else + var snapshot = Snapshot.Create(postFix: "_net_8_0"); +#endif snapshot.Add(result.ToJson(), "Result", MarkdownLanguages.Json); diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc_Brand_Name__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc_Brand_Name__net_8_0.md new file mode 100644 index 00000000000..3c951e8b3ad --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc_Brand_Name__net_8_0.md @@ -0,0 +1,99 @@ +# Query_Brands_First_2_And_Products_First_2_Name_Desc_Brand_Name + +## Result + +```json +{ + "data": { + "brands": { + "nodes": [ + { + "id": "QnJhbmQ6OQ==", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo5", + "name": "VenturePro GPS Watch", + "brand": { + "name": "AirStrider" + } + }, + { + "id": "UHJvZHVjdDozNA==", + "name": "Velocity Red Bike Helmet", + "brand": { + "name": "AirStrider" + } + } + ] + } + }, + { + "id": "QnJhbmQ6NQ==", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo1", + "name": "Blizzard Rider Snowboard", + "brand": { + "name": "B&R" + } + }, + { + "id": "UHJvZHVjdDoyMA==", + "name": "Explorer Biking Computer", + "brand": { + "name": "B&R" + } + } + ] + } + } + ] + } + } +} +``` + +## Query 1 + +```sql +-- @__p_0='3' +SELECT b."Id", b."Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + +## Query 2 + +```sql +-- @__brandIds_0={ '5', '9' } (DbType = Object) +SELECT t."BrandId", t0."Id", t0."Name", t0."BrandId" +FROM ( + SELECT p."BrandId" + FROM "Products" AS p + WHERE p."BrandId" = ANY (@__brandIds_0) + GROUP BY p."BrandId" +) AS t +LEFT JOIN ( + SELECT t1."Id", t1."Name", t1."BrandId" + FROM ( + SELECT p0."Id", p0."Name", p0."BrandId", ROW_NUMBER() OVER(PARTITION BY p0."BrandId" ORDER BY p0."Id") AS row + FROM "Products" AS p0 + WHERE p0."BrandId" = ANY (@__brandIds_0) + ) AS t1 + WHERE t1.row <= 3 +) AS t0 ON t."BrandId" = t0."BrandId" +ORDER BY t."BrandId" +``` + +## Query 3 + +```sql +-- @__ids_0={ '5', '9' } (DbType = Object) +SELECT b."Id", b."Name" +FROM "Brands" AS b +WHERE b."Id" = ANY (@__ids_0) +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc__net_8_0.md new file mode 100644 index 00000000000..0809c373381 --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2_Name_Desc__net_8_0.md @@ -0,0 +1,80 @@ +# Query_Brands_First_2_And_Products_First_2_Name_Desc + +## Result + +```json +{ + "data": { + "brands": { + "nodes": [ + { + "id": "QnJhbmQ6OQ==", + "name": "AirStrider", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo5", + "name": "VenturePro GPS Watch" + }, + { + "id": "UHJvZHVjdDozNA==", + "name": "Velocity Red Bike Helmet" + } + ] + } + }, + { + "id": "QnJhbmQ6NQ==", + "name": "B&R", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo1", + "name": "Blizzard Rider Snowboard" + }, + { + "id": "UHJvZHVjdDoyMA==", + "name": "Explorer Biking Computer" + } + ] + } + } + ] + } + } +} +``` + +## Query 1 + +```sql +-- @__p_0='3' +SELECT b."Id", b."Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + +## Query 2 + +```sql +-- @__brandIds_0={ '5', '9' } (DbType = Object) +SELECT t."BrandId", t0."Id", t0."Name", t0."BrandId" +FROM ( + SELECT p."BrandId" + FROM "Products" AS p + WHERE p."BrandId" = ANY (@__brandIds_0) + GROUP BY p."BrandId" +) AS t +LEFT JOIN ( + SELECT t1."Id", t1."Name", t1."BrandId" + FROM ( + SELECT p0."Id", p0."Name", p0."BrandId", ROW_NUMBER() OVER(PARTITION BY p0."BrandId" ORDER BY p0."Id") AS row + FROM "Products" AS p0 + WHERE p0."BrandId" = ANY (@__brandIds_0) + ) AS t1 + WHERE t1.row <= 3 +) AS t0 ON t."BrandId" = t0."BrandId" +ORDER BY t."BrandId" +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2__net_8_0.md new file mode 100644 index 00000000000..7ba396d8a3d --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2_And_Products_First_2__net_8_0.md @@ -0,0 +1,80 @@ +# Query_Brands_First_2_And_Products_First_2 + +## Result + +```json +{ + "data": { + "brands": { + "nodes": [ + { + "id": "QnJhbmQ6OQ==", + "name": "AirStrider", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo5", + "name": "VenturePro GPS Watch" + }, + { + "id": "UHJvZHVjdDozNA==", + "name": "Velocity Red Bike Helmet" + } + ] + } + }, + { + "id": "QnJhbmQ6NQ==", + "name": "B&R", + "products": { + "nodes": [ + { + "id": "UHJvZHVjdDo1", + "name": "Blizzard Rider Snowboard" + }, + { + "id": "UHJvZHVjdDoyMA==", + "name": "Explorer Biking Computer" + } + ] + } + } + ] + } + } +} +``` + +## Query 1 + +```sql +-- @__p_0='3' +SELECT b."Id", b."Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + +## Query 2 + +```sql +-- @__brandIds_0={ '5', '9' } (DbType = Object) +SELECT t."BrandId", t0."Id", t0."Name", t0."BrandId" +FROM ( + SELECT p."BrandId" + FROM "Products" AS p + WHERE p."BrandId" = ANY (@__brandIds_0) + GROUP BY p."BrandId" +) AS t +LEFT JOIN ( + SELECT t1."Id", t1."Name", t1."BrandId" + FROM ( + SELECT p0."Id", p0."Name", p0."BrandId", ROW_NUMBER() OVER(PARTITION BY p0."BrandId" ORDER BY p0."Id") AS row + FROM "Products" AS p0 + WHERE p0."BrandId" = ANY (@__brandIds_0) + ) AS t1 + WHERE t1.row <= 3 +) AS t0 ON t."BrandId" = t0."BrandId" +ORDER BY t."BrandId" +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2__net_8_0.md new file mode 100644 index 00000000000..dd54cbdf3b4 --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands_First_2__net_8_0.md @@ -0,0 +1,33 @@ +# Query_Brands_First_2 + +## Result + +```json +{ + "data": { + "brands": { + "nodes": [ + { + "id": "QnJhbmQ6OQ==", + "name": "AirStrider" + }, + { + "id": "QnJhbmQ6NQ==", + "name": "B&R" + } + ] + } + } +} +``` + +## Query 1 + +```sql +-- @__p_0='3' +SELECT b."Id", b."Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands__net_8_0.md new file mode 100644 index 00000000000..96144d7daf7 --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Brands__net_8_0.md @@ -0,0 +1,65 @@ +# Query_Brands + +## Result + +```json +{ + "data": { + "brands": { + "nodes": [ + { + "id": "QnJhbmQ6OQ==", + "name": "AirStrider" + }, + { + "id": "QnJhbmQ6NQ==", + "name": "B&R" + }, + { + "id": "QnJhbmQ6MQ==", + "name": "Daybird" + }, + { + "id": "QnJhbmQ6Mg==", + "name": "Gravitator" + }, + { + "id": "QnJhbmQ6MTA=", + "name": "Green Equipment" + }, + { + "id": "QnJhbmQ6OA==", + "name": "Grolltex" + }, + { + "id": "QnJhbmQ6MTI=", + "name": "Legend" + }, + { + "id": "QnJhbmQ6NA==", + "name": "Quester" + }, + { + "id": "QnJhbmQ6Ng==", + "name": "Raptor Elite" + }, + { + "id": "QnJhbmQ6Nw==", + "name": "Solstix" + } + ] + } + } +} +``` + +## Query 1 + +```sql +-- @__p_0='11' +SELECT b."Id", b."Name" +FROM "Brands" AS b +ORDER BY b."Name", b."Id" +LIMIT @__p_0 +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Brand__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Brand__net_8_0.md new file mode 100644 index 00000000000..4c1b8927623 --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Brand__net_8_0.md @@ -0,0 +1,24 @@ +# Query_Node_Brand + +## Result + +```json +{ + "data": { + "brand": { + "id": "QnJhbmQ6MQ==", + "name": "Daybird" + } + } +} +``` + +## Query 1 + +```sql +-- @__ids_0={ '1' } (DbType = Object) +SELECT b."Id", b."Name" +FROM "Brands" AS b +WHERE b."Id" = ANY (@__ids_0) +``` + diff --git a/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Product__net_8_0.md b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Product__net_8_0.md new file mode 100644 index 00000000000..c9b8897909d --- /dev/null +++ b/src/HotChocolate/Data/test/Data.PostgreSQL.Tests/__snapshots__/IntegrationTests.Query_Node_Product__net_8_0.md @@ -0,0 +1,24 @@ +# Query_Node_Product + +## Result + +```json +{ + "data": { + "product": { + "id": "UHJvZHVjdDox", + "name": "Wanderer Black Hiking Boots" + } + } +} +``` + +## Query 1 + +```sql +-- @__ids_0={ '1' } (DbType = Object) +SELECT p."Id", p."Name" +FROM "Products" AS p +WHERE p."Id" = ANY (@__ids_0) +``` + diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Deep_SecondPage.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Deep_SecondPage.md index baca9a63d8c..d2107eb8d9b 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Deep_SecondPage.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Deep_SecondPage.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Country1' --- @__p_1='2' +-- @__value_0='Country1' +-- @__value_1='2' -- @__p_2='3' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."BrandDetails_Country_Name" > @__p_0 OR (b."BrandDetails_Country_Name" = @__p_0 AND b."Id" > @__p_1) +WHERE b."BrandDetails_Country_Name" > @__value_0 OR (b."BrandDetails_Country_Name" = @__value_0 AND b."Id" > @__value_1) ORDER BY b."BrandDetails_Country_Name", b."Id" LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(x => x.BrandDetails.Country.Name).ThenBy(t => t.Id).Where(t => ((t.BrandDetails.Country.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse ((t.BrandDetails.Country.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(3) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(x => x.BrandDetails.Country.Name).ThenBy(t => t.Id).Where(t => ((t.BrandDetails.Country.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.BrandDetails.Country.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(3) ``` ## Result diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_Fallback_SecondPage.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_Fallback_SecondPage.md index 687f39e78df..724cac695e1 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_Fallback_SecondPage.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_Fallback_SecondPage.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand:11' --- @__p_1='12' +-- @__value_0='Brand:11' +-- @__value_1='12' -- @__p_2='3' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE COALESCE(b."DisplayName", b."Name") > @__p_0 OR (COALESCE(b."DisplayName", b."Name") = @__p_0 AND b."Id" > @__p_1) +WHERE COALESCE(b."DisplayName", b."Name") > @__value_0 OR (COALESCE(b."DisplayName", b."Name") = @__value_0 AND b."Id" > @__value_1) ORDER BY COALESCE(b."DisplayName", b."Name"), b."Id" LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => (t.DisplayName ?? t.Name)).ThenBy(t => t.Id).Where(t => (((t.DisplayName ?? t.Name).CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse (((t.DisplayName ?? t.Name).CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(3) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => (t.DisplayName ?? t.Name)).ThenBy(t => t.Id).Where(t => (((t.DisplayName ?? t.Name).CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse (((t.DisplayName ?? t.Name).CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(3) ``` ## Result diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_SecondPage.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_SecondPage.md index dbcf40010ff..ff74e8dfd76 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_SecondPage.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetDefaultPage_With_Nullable_SecondPage.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand10' --- @__p_2='11' +-- @__value_0='Brand10' +-- @__value_2='11' -- @__p_3='3' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" > @__p_0 OR (b."Name" = @__p_0 AND b."AlwaysNull" > NULL) OR (b."Name" = @__p_0 AND b."AlwaysNull" IS NULL AND b."Id" > @__p_2) +WHERE b."Name" > @__value_0 OR (b."Name" = @__value_0 AND b."AlwaysNull" > NULL) OR (b."Name" = @__value_0 AND b."AlwaysNull" IS NULL AND b."Id" > @__value_2) ORDER BY b."Name", b."AlwaysNull", b."Id" LIMIT @__p_3 ``` @@ -16,7 +16,7 @@ LIMIT @__p_3 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(x => x.AlwaysNull).ThenBy(t => t.Id).Where(t => (((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.AlwaysNull.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0))) OrElse (((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.AlwaysNull.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0)) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(3) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(x => x.AlwaysNull).ThenBy(t => t.Id).Where(t => (((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.AlwaysNull.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0))) OrElse (((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.AlwaysNull.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0)) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(3) ``` ## Result diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetSecondPage_With_2_Items.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetSecondPage_With_2_Items.md index 0106d900ea2..e86b674e184 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetSecondPage_With_2_Items.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.GetSecondPage_With_2_Items.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand17' --- @__p_1='18' +-- @__value_0='Brand17' +-- @__value_1='18' -- @__p_2='3' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" > @__p_0 OR (b."Name" = @__p_0 AND b."Id" > @__p_1) +WHERE b."Name" > @__value_0 OR (b."Name" = @__value_0 AND b."Id" > @__value_1) ORDER BY b."Name", b."Id" LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(3) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(3) ``` ## Result diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md index ff7c5c8d931..57afb399be8 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_After_Id_13.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand12' --- @__p_1='13' +-- @__value_0='Brand12' +-- @__value_1='13' -- @__p_2='6' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" > @__p_0 OR (b."Name" = @__p_0 AND b."Id" > @__p_1) +WHERE b."Name" > @__value_0 OR (b."Name" = @__value_0 AND b."Id" > @__value_1) ORDER BY b."Name", b."Id" LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) > 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) > 0)))).Take(6) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) > 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) > 0)))).Take(6) ``` ## Result 3 diff --git a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md index 66ad9cab02a..fdff316caee 100644 --- a/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md +++ b/src/HotChocolate/Data/test/Data.Tests/__snapshots__/IntegrationPagingHelperTests.Paging_First_5_Before_Id_96.md @@ -3,12 +3,12 @@ ## SQL 0 ```sql --- @__p_0='Brand95' --- @__p_1='96' +-- @__value_0='Brand95' +-- @__value_1='96' -- @__p_2='6' SELECT b."Id", b."AlwaysNull", b."DisplayName", b."Name", b."BrandDetails_Country_Name" FROM "Brands" AS b -WHERE b."Name" < @__p_0 OR (b."Name" = @__p_0 AND b."Id" < @__p_1) +WHERE b."Name" < @__value_0 OR (b."Name" = @__value_0 AND b."Id" < @__value_1) ORDER BY b."Name" DESC, b."Id" DESC LIMIT @__p_2 ``` @@ -16,7 +16,7 @@ LIMIT @__p_2 ## Expression 0 ```text -[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) < 0) OrElse ((t.Name.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value, String)) == 0) AndAlso (t.Id.CompareTo(Convert(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value, Int32)) < 0)))).Reverse().Take(6) +[Microsoft.EntityFrameworkCore.Query.EntityQueryRootExpression].OrderBy(t => t.Name).ThenBy(t => t.Id).Where(t => ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) < 0) OrElse ((t.Name.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.String]).value) == 0) AndAlso (t.Id.CompareTo(value(GreenDonut.Data.Expressions.ExpressionHelpers+<>c__DisplayClass7_0`1[System.Int32]).value) < 0)))).Reverse().Take(6) ``` ## Result 3