From 95167e3d761aa21ae47c9ae20b821d2b55ae1e22 Mon Sep 17 00:00:00 2001 From: Christopher Jolly <chris-jolly_au@hotmail.com> Date: Wed, 23 Oct 2024 23:13:04 +0800 Subject: [PATCH] Apply fix from #34729 to Cosmos SqlExpressionFactory to keep it in sync --- src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs index b4cfb0938a5..48808848457 100644 --- a/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs +++ b/src/EFCore.Cosmos/Query/Internal/SqlExpressionFactory.cs @@ -156,7 +156,7 @@ private SqlExpression ApplyTypeMappingOnSqlBinary( case ExpressionType.Coalesce: { inferredTypeMapping = typeMapping ?? ExpressionExtensions.InferTypeMapping(left, right); - resultType = inferredTypeMapping?.ClrType ?? left.Type; + resultType = inferredTypeMapping?.ClrType ?? (left.Type != typeof(object) ? left.Type : right.Type); resultTypeMapping = inferredTypeMapping; break; }