Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-11984

.NET CompiledQuery won't work with strings

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.7.5
    • Fix Version/s: None
    • Component/s: platforms
    • Labels:
      None

      Description

      Consider two samples:

      var cache = GetClientCache<Person>();
      var persons = cache.AsCacheQueryable();

       

      This works:

      var qry = CompiledQuery.Compile((int id) => persons.Where(x => x.Value.Id == id));

       

      This won't:

      var qry = CompiledQuery.Compile((string id) => persons.Where(x => x.Value.Name.Equals(id)));

       

      Error compiling query: entire LINQ expression should be specified within lambda passed to Compile method.

       

      Reason: 

      GetCompiledQuery method -> var paramValues becomes null

      Because of that CacheQueryExpressionVisitor -> VisitConstant will not be executed

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ptupitsyn Pavel Tupitsyn
                Reporter:
                ashapkin Alexandr Shapkin
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: