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

Using the same parameter name for two differently typed where clauses throws an exception

    Details

    • Sprint:

      Description

      A simple query like the following throws an exception:

      var result = session.Query<Entity1>()
      .Where(x => x.Name == "Something")
      .SelectMany(x => x.Entity2s)
      .Where(x => x.Category == "Anything")
      .ToList();

      The exception is: "QueryException : could not resolve property: Name of: Entity2"
      NHibernate is searching the "Name" property in the "Entity2" class although it only exists in the "Entity1" class.

      Renaming the "x" in any of the where clauses to anything different makes the query work.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cremor cremor
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Who's Looking?