I've searched in NH code, and found the root of the problem (i think)
in ExpressionProcessor class, you can find in few: "if
(unaryExpression.NodeType != ExpressionType.Convert)"
the problem is, the type is ConvertChecked and not Convert. i changed
the code from
if (unaryExpression.NodeType != ExpressionType.Convert)
to
if ((unaryExpression.NodeType != ExpressionType.Convert) &&
(unaryExpression.NodeType != ExpressionType.ConvertChecked))
lines: 173, 229, 305, 343
it did the job for me. and there isn't any hazard changing it as much
as i'm understanding (or is it and i'm missing something?).

I would like to hear what you think about it, and what i can do (more/
else...)

long live open-source :))

Thank,
Nadav

On Aug 21, 4:41 pm, Nadav Ben-Gal <[email protected]> wrote:
> Hey,
> I just updated from NH 3.0 to NH 3.2. (downloaded from the site, not
> nuget)
> I'm developing in c# 3.5, working on a winforms project.
> my database is mysql (5.1.42-community)
> ------
> after the updated the following query ( or any other queryover with
> involves enum):
> Session.QueryOver<Entity>().Where(e => e.Type !=
> Entity.EntityType.General).List();
> throws the following exception:
> 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
>    at
> NHibernate.Impl.ExpressionProcessor.FindMemberProjection(Expression
> expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \ExpressionProcessor.cs:line 166
>    at
> NHibernate.Impl.ExpressionProcessor.ProcessSimpleExpression(Expression
> left, Expression right, ExpressionType nodeType) in d:\CSharp\NH\NH
> \nhibernate\src\NHibernate\Impl\ExpressionProcessor.cs:line 414
>    at
> NHibernate.Impl.ExpressionProcessor.ProcessSimpleExpression(BinaryExpressio n
> be) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \ExpressionProcessor.cs:line 409
>    at
> NHibernate.Impl.ExpressionProcessor.ProcessBinaryExpression(BinaryExpressio n
> expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \ExpressionProcessor.cs:line 506
>    at NHibernate.Impl.ExpressionProcessor.ProcessExpression(Expression
> expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \ExpressionProcessor.cs:line 580
>    at
> NHibernate.Impl.ExpressionProcessor.ProcessLambdaExpression(LambdaExpressio n
> expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
> \ExpressionProcessor.cs:line 587
>    at NHibernate.Impl.ExpressionProcessor.ProcessExpression[T]
> (Expression`1 expression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate
> \Impl\ExpressionProcessor.cs:line 598
>    at NHibernate.Criterion.QueryOver`2.Add(Expression`1 expression) in
> d:\CSharp\NH\NH\nhibernate\src\NHibernate\Criterion\QueryOver.cs:line
> 749
>    at NHibernate.Criterion.QueryOver`2.Where(Expression`1 expression)
> in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Criterion
> \QueryOver.cs:line 357
>    at
> NHibernate.Criterion.QueryOver`2.NHibernate.IQueryOver<TRoot,TSubType>.Wher 
> e(Expression`1
> expression) in
>
> the enum is:
>         public enum EntityType
>         {
>             v1 = 0,
>             v2 = 1,
>             ....
>             General = 999
>         }
>
> Property code:
>
>         public virtual EntityType Type
>         {
>             get { return type; }
>             set { type = value; }
>         }
>
> the mapping for it is:
> <property name="Type" column="ENT_TYPE"/>
> the column is an integer in the database.
>
> i saw a jira bug that was fixed (https://nhibernate.jira.com/browse/
> NH-2712) and another on (https://nhibernate.jira.com/browse/NH-2763)
> that isn't, but both says vb.net.
> I tried marking that column as not-null (both mapping and updated the
> db) but it didn't helped.
>
> any ideas why it does not work and more important, what i need to do
> in order to fix it?
>
> Thanks,
> Nadav

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to