From 908f4d784be47a8c00ae22a5e53857894a05e599 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Mon, 19 Oct 2020 23:52:07 +0300 Subject: [PATCH] Add missing Ordinal to parameter StartsWith comparison This backports the fix for #18831 to 3.1 --- src/EFCore.Relational/Storage/RelationalSqlGenerationHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EFCore.Relational/Storage/RelationalSqlGenerationHelper.cs b/src/EFCore.Relational/Storage/RelationalSqlGenerationHelper.cs index af27324bb63..cb596b6bada 100644 --- a/src/EFCore.Relational/Storage/RelationalSqlGenerationHelper.cs +++ b/src/EFCore.Relational/Storage/RelationalSqlGenerationHelper.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.IO; using System.Text; using JetBrains.Annotations; @@ -57,7 +58,7 @@ public RelationalSqlGenerationHelper([NotNull] RelationalSqlGenerationHelperDepe /// A valid name based on the candidate name. /// public virtual string GenerateParameterName(string name) - => name.StartsWith("@") + => name.StartsWith("@", StringComparison.Ordinal) ? name : "@" + name;