Uploaded image for project: 'NHibernate [Moved to GitHub]'
  1. NH-2452

NH 3.0 Linq provider does not correctly translate standard .Key property when grouping

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects versions: 3.0.0.GA
    • Fix versions: 3.3.0.CR1
    • Components: Linq Provider
    • Labels:
      None
    • Sprint:

      Description

      There's a problem in the LINQ provider when translating the grouping
      Key property to SQL.

      Example:

      my simplified entity:

      public class Simple
      {
      public string Division

      {get;set;}
      public decimal Amount {get;set;}

      }

      ....

      var actual=from div in session.Query<Simple>()
      select div;

      var
      result=actual.GroupBy(i=>i.Division).OrderBy(g=>g.Key).Select(g=>new

      { Division=g.Max(i=>i.Division),TotalAmount=g.Sum(i=>i.Amount)}

      );

      This results in

      base

      {NHibernate.HibernateException}

      = {"could not resolve property:
      Key of: DomainModel.Entities.Simple
      [.Select(.OrderBy(.GroupBy(.Where(.Select(NHibernate.Linq.NhQueryable`1DomainModel.Entities.Simple,
      Quote((detail, ) => (detail)), ), Quote((item, ...

      This is causing us a large problem that we cannot control using third
      party rapid development UI controls that use LinqServerModeDataSource,
      which work with any LINQ provider. It allows passing an IQueryable to
      a proprietary grid's data source, which allows to transfer any sorting/
      grouping/filtering/paging expressions made in the grid directly to the
      data source. Everything works in that respect with NHIbernate LINQ provider,
      but the grouping, due to missing translation support for .Key grouping
      property.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kmikhai Mike Katchourine
              • Votes:
                4 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?