LINQ driver does not support nested paging (i.e. take/skip).

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 2.1
    • Affects Version/s: 1.9.1
    • Component/s: LINQ
    • None
    • Environment:
      .NET 4.5, VS2012, Win7, Azure, OData v4, Web API
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Craig Wilson
            Reporter:
            bothead
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: