Fix bool value mapping.

pull/48/head
Lau 6 years ago
parent db47437539
commit 48bc49d3a4

@ -37,9 +37,9 @@ namespace EntityFrameworkCore.Jet.Query.Internal
{
new CaseWhenClause(
sqlExpression,
_sqlExpressionFactory.ApplyDefaultTypeMapping(_sqlExpressionFactory.Constant(/*true*/ 1)))
_sqlExpressionFactory.ApplyDefaultTypeMapping(_sqlExpressionFactory.Constant(true)))
},
_sqlExpressionFactory.Constant(/*false*/ 0))
_sqlExpressionFactory.Constant(false))
: sqlExpression;
}
@ -268,10 +268,10 @@ namespace EntityFrameworkCore.Jet.Query.Internal
_isSearchCondition = parentSearchCondition;
var newFunction = sqlFunctionExpression.Update(instance, arguments);
var condition = string.Equals(sqlFunctionExpression.Name, "FREETEXT")
|| string.Equals(sqlFunctionExpression.Name, "CONTAINS");
// var condition = string.Equals(sqlFunctionExpression.Name, "FREETEXT")
// || string.Equals(sqlFunctionExpression.Name, "CONTAINS");
return ApplyConversion(newFunction, condition);
return ApplyConversion(newFunction, /* condition */ false);
}
protected override Expression VisitSqlParameter(SqlParameterExpression sqlParameterExpression)

@ -224,18 +224,16 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
protected override Expression VisitOrdering(OrderingExpression orderingExpression)
{
// Instead of the following, we are using SearchConditionConvertingExpressionVisitor.
// Jet uses the value -1 as True, so ordering by a boolean expression will first list the True values
// before the False values, which is the opposite of what .NET and other DBMS do, which are using 1 as True.
/*
if (orderingExpression.Expression.TypeMapping == _boolTypeMapping)
{
orderingExpression = new OrderingExpression(
orderingExpression.Expression,
!orderingExpression.IsAscending);
}
*/
return base.VisitOrdering(orderingExpression);
}

@ -23,7 +23,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
protected override string GenerateNonNullSqlLiteral(object value)
=> (bool) value
? "True"
: "False";
? "TRUE"
: "FALSE";
}
}
Loading…
Cancel
Save