There is no function to create a new guid in MS Access. Translate Guid.NewGuid client side while generating the SQL

pull/213/head
Christopher Jolly 2 years ago
parent 783725e4d4
commit e4770f4f04

@ -24,13 +24,16 @@ namespace EntityFrameworkCore.Jet.Query.ExpressionTranslators.Internal
public SqlExpression? Translate(SqlExpression? instance, MethodInfo method, IReadOnlyList<SqlExpression> arguments, IDiagnosticsLogger<DbLoggerCategory.Query> logger)
{
return _methodInfo.Equals(method)
/*(return _methodInfo.Equals(method)
? _sqlExpressionFactory.Function(
"NEWGUID",
Array.Empty<SqlExpression>(),
false,
new[] { false },
method.ReturnType)
: null;*/
return _methodInfo.Equals(method)
? _sqlExpressionFactory.Constant(Guid.NewGuid(), method.ReturnType)
: null;
}
}

@ -1502,11 +1502,14 @@ WHERE `o`.`OrderID` = 11077 AND (`o`.`Discount` * (3.1415927 / 180)) > 0
public override async Task Where_guid_newguid(bool isAsync)
{
await base.Where_guid_newguid(isAsync);
AssertSql(
$@"SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
FROM `Order Details` AS `o`
WHERE (GenGUID() <> '00000000-0000-0000-0000-000000000000') OR GenGUID() IS NULL");
//Don't validate SQL. GUID changes on each execution.
/*AssertSql(
"""
SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
FROM `Customers` AS `c`
WHERE '{638fa0fe-7a53-418d-958e-431093428c62}' <> '{00000000-0000-0000-0000-000000000000}'
""");*/
}
public override async Task Where_string_to_upper(bool isAsync)

Loading…
Cancel
Save