Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-3176

Ability to project collections using QueryOver

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.0.GA
    • Fix Version/s: None
    • Component/s: QueryOver

      Description

      Unable to project collections when using QueryOver:

      Customer customerAlias = null;
      Order orderAlias = null;
      var list = _session.QueryOver<Customer>(() => customerAlias)
      .JoinAlias(x => x.Orders, () => orderAlias, JoinType.LeftOuterJoin)
      .Select(
      Projections.Property(() => customerAlias.Name),
      Projections.Property(() => customerAlias.Orders))//this is the issue
      .List<object>();

      Error returned is:
      System.IndexOutOfRangeException : Index was outside the bounds of the array

        Gliffy Diagrams

          Activity

          Hide
          oskar.berggren Oskar Berggren added a comment -

          I can find no mention in the reference documentation that the feature "project a collection" exist in QueryOver or Criteria.

          Show
          oskar.berggren Oskar Berggren added a comment - I can find no mention in the reference documentation that the feature "project a collection" exist in QueryOver or Criteria.
          Hide
          evilrabbit Evil Rabbit added a comment -

          Thanks for the note - so I can assume this is a feature request and not a bug?

          Show
          evilrabbit Evil Rabbit added a comment - Thanks for the note - so I can assume this is a feature request and not a bug?
          Hide
          lunadie Luis Fernando added a comment -

          I wonder if there is a recommended approach for this case, both in QueryOver or Linq provider, or if at least this is a feature considered for the future.

          What if I only need a property (only one!) within the child collection, for example like this: "Employees.Orders.OrderDate"

          Show
          lunadie Luis Fernando added a comment - I wonder if there is a recommended approach for this case, both in QueryOver or Linq provider, or if at least this is a feature considered for the future. What if I only need a property (only one!) within the child collection, for example like this: "Employees.Orders.OrderDate"

            People

            • Assignee:
              Unassigned
              Reporter:
              evilrabbit Evil Rabbit
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Who's Looking?