From 306585af13a91c1ae5c7ee21483100aa295b8e03 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 26 Apr 2023 01:02:56 +0800 Subject: [PATCH] When dealing with convert, if we don't have a specific conversion function, try just send the original operand and let Jet work with the types. Seems to be fairly lenient --- .../Query/Sql/Internal/JetQuerySqlGenerator.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs index 3a8100d..d85c132 100644 --- a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs +++ b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs @@ -362,12 +362,12 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal return convertExpression; } - if (typeMapping.ClrType.IsEnum) - { - Visit(convertExpression.Operand); - return convertExpression; - } - throw new InvalidOperationException($"Cannot cast to CLR type '{typeMapping.ClrType.Name}' with Jet."); + //Just pass the operand in the default case + //If we have a type mapping on the operand, then it seems to work fine + //Jet appears to be fairly flexible when types aren't specifically mentioned + //Keep an eye on this for any further problems - doesn't show anything in the tests right now + Visit(convertExpression.Operand); + return convertExpression; } ///