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

Unable to use enums in NH 3.2 QueryOver checked comparison

    Details

    • Sprint:

      Description

      Not sure if it is the right priority and the right components.
      see:
      http://groups.google.com/group/nhusers/browse_thread/thread/7cccf7651bf8c552?hl=en
      for complete history.
      ===============
      Session.QueryOver<Entity>().Where(e => e.Type !=
      Entity.EntityType.General).List();
      throws: Cannot interpret member from ConvertChecked(e.Type)
      at NHibernate.Impl.ExpressionProcessor.IsMemberExpression(Expression expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\ExpressionProcessor.cs:line 346
      exception.

      the problem comes from lines: 173, 229, 305, 343 (ExpressionProcessor class) where if (unaryExpression.NodeType != ExpressionType.Convert) it throw the exception.
      the problem is, the unaryExpression.NodeType is ConvertChecked and not Convert.

      I have changed the if locally to
      if ((unaryExpression.NodeType != ExpressionType.Convert) && (unaryExpression.NodeType != ExpressionType.ConvertChecked))
      and it worked fine, and didn't rise any new problems. (and should as much as i understand the difference between Convert and ConvertChecked).
      ========
      THAT SAID,
      I didn't checked other versions, but before i upgraded to NH 3.2GA i worked with 3.0 and ByteCode.Castle and the exact same code worked.
      so the real problem is way the expression suddenly appears as ConvertChecked and not Convert (I checked the code, the If is the same, it didn't change between 3.0GA and 3.2GA)

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                flukefan Richard Brown
                Reporter:
                nadav Nadav Ben-Gal
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?