WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

$skiptoken is always returns null when combined with $Select

Open PrathibaNet opened this issue 3 years ago • 7 comments

*We are using Microsoft.AspNetCore.OData 7.5.6. We have a API which returns a list of items with pagesize as 20, and skiptoken enabled. The API returns response with nextlink with proper skiptoken when no $Select parameter is there. whenever $Select parameter is added, it always return null for skiptoken *

Assemblies affected

*Microsoft.AspNetCore.OData 7.5.6

Reproduce steps

Expose a API endpoint in ASP.Net Core with OData Support. Set page size, enable skiptoken as well. When directly accessing the API endpoint without any oData Query then the next page link coming properly with correct skiptoken=id-1 But when we use $Select odata query , then the $skiptoken=id-null is returned.

Expected result

when we use $Select odata query , then the $skiptoken should come proper

Actual result

when we use $Select odata query , then the $skiptoken=id-null is returned.

PrathibaNet avatar Sep 02 '21 11:09 PrathibaNet

Hi , is there any workaround for this issue

PrathibaNet avatar Sep 15 '21 12:09 PrathibaNet

Any updates on this issue, please

PrathibaNet avatar Sep 20 '21 13:09 PrathibaNet

@xuzhg @ElizabethOkerio can you please provide any update on this issue

PrathibaNet avatar Sep 30 '21 11:09 PrathibaNet

@xuzhg, I think the main issue is with respect to the way the sql queries are formed when $Select is Used using EF Core 3.0 When $Select used Executed DbCommand (195ms) [Parameters=[@__TypedProperty_1='?' (DbType = Int32), @__TypedProperty_0='?' (Size = 4000)], CommandType='Text', CommandTimeout='200'] SELECT TOP(@__TypedProperty_1) @__TypedProperty_0 AS [ModelID], N'name' AS [Name], [l].[Name] AS [Value], N'Id' AS [Name], [l].[Id] AS [Value] FROM Details] AS [l] WHERE [l].[Active] = CAST(1 AS bit) ORDER BY [l].[Id]

Without $Select Executed DbCommand (116ms) [Parameters=[@__TypedProperty_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='200'] SELECT TOP(@__TypedProperty_0) [l].[Id], [l].[Active], [l].[Name], [l].[SortOrder] FROM [Details] AS [l] WHERE [l].[Active] = CAST(1 AS bit) ORDER BY [l].[Id]

PrathibaNet avatar Oct 05 '21 07:10 PrathibaNet

Any help is highly appreciated :)

PrathibaNet avatar Oct 05 '21 07:10 PrathibaNet

Without EF Core , when raw data is loaded and verified in IEnumerable, then the issue is not there

PrathibaNet avatar Oct 05 '21 07:10 PrathibaNet

@xuzhg @ElizabethOkerio can you please provide any update on this issue?

rachna-lad avatar Jun 08 '22 08:06 rachna-lad