From 38d046cff55385af6fcffc08a30269f080a3b9e6 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Wed, 23 Nov 2022 11:27:36 +0100 Subject: [PATCH] Case-insensitive comparison for store types --- src/EFCore.Relational/Query/QuerySqlGenerator.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index 2d953aa6d13..7dd6cbf143d 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -602,11 +602,14 @@ protected override Expression VisitSqlParameter(SqlParameterExpression sqlParame // data twice. // Note that if the type mapping differs, we do send the same data twice (e.g. the same string may be sent once as Unicode, once as // non-Unicode). - var parameter = _relationalCommandBuilder.Parameters.FirstOrDefault(p => - p.InvariantName == parameterName - && p is TypeMappedRelationalParameter typeMappedRelationalParameter - && typeMappedRelationalParameter.RelationalTypeMapping.StoreType == sqlParameterExpression.TypeMapping!.StoreType - && typeMappedRelationalParameter.RelationalTypeMapping.Converter == sqlParameterExpression.TypeMapping!.Converter); + var parameter = _relationalCommandBuilder.Parameters.FirstOrDefault( + p => + p.InvariantName == parameterName + && p is TypeMappedRelationalParameter typeMappedRelationalParameter + && string.Equals( + typeMappedRelationalParameter.RelationalTypeMapping.StoreType, sqlParameterExpression.TypeMapping!.StoreType, + StringComparison.OrdinalIgnoreCase) + && typeMappedRelationalParameter.RelationalTypeMapping.Converter == sqlParameterExpression.TypeMapping!.Converter); if (parameter is null) {