From a93c205194af4cbe14bbfc75c540fc9c8d765c33 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 12 Sep 2023 23:49:47 +0800 Subject: [PATCH] When using FromSql, parameters can end up named without the @ at the beginning. This leads to the failure to match it to the Sql where the string is generated with the @. If we can't find the parameter using the normal name, try to pick it up when excluding the @ --- src/EFCore.Jet.Data/JetCommand.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/EFCore.Jet.Data/JetCommand.cs b/src/EFCore.Jet.Data/JetCommand.cs index 8c2c1da..3047cb5 100644 --- a/src/EFCore.Jet.Data/JetCommand.cs +++ b/src/EFCore.Jet.Data/JetCommand.cs @@ -693,6 +693,12 @@ namespace EntityFrameworkCore.Jet.Data var parameter = unusedParameters .FirstOrDefault(p => placeholder.Name.Equals(p.ParameterName, StringComparison.Ordinal)); + if (parameter == null) + { + parameter = unusedParameters + .FirstOrDefault(p => !p.ParameterName.StartsWith('@') && placeholder.Name.Substring(1).Equals(p.ParameterName, StringComparison.Ordinal)); + } + if (parameter != null) { placeholder.Parameter = parameter;