[CSHARP-1016] LINQ driver does not support nested paging (i.e. take/skip). Created: 15/Jul/14  Updated: 13/Apr/16  Resolved: 24/Apr/15

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: 1.9.1
Fix Version/s: 2.1

Type: Improvement Priority: Minor - P4
Reporter: bothead Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.NET 4.5, VS2012, Win7, Azure, OData v4, Web API


Epic Link: Rewrite Linq

 Description   

I am hosting a RESTful Web API service using OData v4. When attempting to perform the following query:

https://127.0.0.1:444/QA/main/Graphs/Items?$expand=Attributes&$skip=672

we see the following error:

"Skip and Take may only be used in conjunction with each other and cannot be separated by other operations."

The previously specified OData query results in paging on both the entity set for 'Items' and the contained entity set 'Attributes' because we have a page size set of 672 also, which results in a take being applied to the expression over the Attributes entity set.

For example, here is the expression that fails:

+ _expression {value(MongoDB.Driver.Linq.MongoQueryable`1[SE.OIP.DFL.Domain.Entities.Graphs.Item]).Where(o => ((o.Tenant == value(SE.OIP.DFL.Data.Repository.Mongo.Graphs.ItemsMongoRepository).tenant) AndAlso (o.Storage == value(SE.OIP.DFL.Data.Repository.Mongo.Graphs.ItemsMongoRepository).storage))).OfType().OrderBy($it => $it.InstanceId).Skip(value(System.Web.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Int32]).TypedProperty).Select(Param_0 => new SelectAllAndExpand`1() {ModelID = "1ca23847-7ec1-49d4-898f-49e8dfe03a24", Instance = Param_0, Container = new CollectionExpandedProperty`1() {Name = "Attributes", Collection = Param_0.Attributes.Take(value(System.Web.OData.Query.Expressions.LinqParameterContainer+TypedLinqParameterContainer`1[System.Int32]).TypedProperty).Select(Param_1 => new SelectAll`1()

{ModelID = "1ca23847-7ec1-49d4-898f-49e8dfe03a24", Instance = Param_1}

), PageSize = 672}})} System.Linq.Expressions.Expression

{System.Linq.Expressions.MethodCallExpressionN}

This fails when it attempts to translate 'take' and the previous expression is 'select', resulting in the exception.



 Comments   
Comment by Craig Wilson [ 24/Apr/15 ]

This was fixed with CSHARP-601.

Generated at Wed Feb 07 21:38:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.