Skip to content

MappedAs throws when called on a Convert UnaryExpression #2708

Closed
@alexrootes

Description

@alexrootes

In an apparent regression between 5.2.7 and 5.3.0 this code will throw where it did not before:

q = q.Where(r => r.Labels == ((IntArray)labels).MappedAs(CustomType.IntArrayType));
HibernateException: MappedAs must be called on an expression which can be evaluated as ConstantExpression. It was call on UnaryExpression instead.

As a workaround removing the inline cast resolves the issue:

var convertedLabels = (IntArray)labels;
q = q.Where(r => r.Labels == convertedLabels.MappedAs(CustomType.IntArrayType));

This could possibly be a result of changes in #2365

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions