NHibernate
  1. NHibernate
  2. NH-3176

Ability to project collections using QueryOver

    Details

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

      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

        Activity

        Hide
        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 added a comment - I can find no mention in the reference documentation that the feature "project a collection" exist in QueryOver or Criteria.
        Hide
        Evil Rabbit added a comment -

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

        Show
        Evil Rabbit added a comment - Thanks for the note - so I can assume this is a feature request and not a bug?
        Hide
        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
        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:
            Evil Rabbit
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Who's Looking?