We are using Automapper package to generate projecting expressions for DO Queries. Beginning with version Automapper 12.0.1 DataObject fails to translate query with error:
Xtensive.Orm.QueryTranslationException : Unable to translate ...
We found that Automapper generates DefaultExpression object which cannot be processed by DO.
Can be reproduced by code like this:
var param = Expression.Parameter(typeof(Location), "o");
var lambda = Expression.Lambda<Func<Location, int>>(
Expression.Condition(
Expression.Equal(param, Expression.Default(typeof(object))),
Expression.Constant(1),
Expression.Constant(2)),
false,
new[] { param });
var result = Session.Query.All<Location>().Select(lambda);
If we replace Expression.Default(typeof(object)) by Expression.Constant((object)null) it does work.
We are using
Automapper
package to generate projecting expressions for DO Queries. Beginning with version Automapper12.0.1
DataObject fails to translate query with error:Xtensive.Orm.QueryTranslationException : Unable to translate ...
We found that Automapper generates
DefaultExpression
object which cannot be processed by DO. Can be reproduced by code like this:If we replace
Expression.Default(typeof(object))
byExpression.Constant((object)null)
it does work.