Skip to content

Commit 1d71634

Browse files
committed
Proper handling for UUID_TO_CHAR.
1 parent 7d7fbb9 commit 1d71634

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Provider/src/FirebirdSql.EntityFrameworkCore.Firebird/Query/ExpressionTranslators/Internal/FbObjectToStringTranslator.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* All Rights Reserved.
1414
*/
1515

16-
//$Authors = Jiri Cincura (jiri@cincura.net), Jean Ressouche, Rafael Almeida (ralms@ralms.net)
16+
//$Authors = Jiri Cincura (jiri@cincura.net)
1717

1818
using System;
1919
using System.Collections.Generic;
@@ -30,7 +30,6 @@ public class FbObjectToStringTranslator : IMethodCallTranslator
3030
typeof(int),
3131
typeof(long),
3232
typeof(DateTime),
33-
typeof(Guid),
3433
typeof(bool),
3534
typeof(byte),
3635
typeof(byte[]),
@@ -49,9 +48,17 @@ public class FbObjectToStringTranslator : IMethodCallTranslator
4948

5049
public virtual Expression Translate(MethodCallExpression methodCallExpression)
5150
{
52-
if (methodCallExpression.Method.Name == nameof(ToString) && methodCallExpression.Arguments.Count == 0 && methodCallExpression.Object != null && SupportedTypes.Contains(methodCallExpression.Object.Type.UnwrapNullableType().UnwrapEnumType()))
51+
if (methodCallExpression.Method.Name == nameof(ToString) && methodCallExpression.Arguments.Count == 0 && methodCallExpression.Object != null)
5352
{
54-
return new ExplicitCastExpression(methodCallExpression.Object, typeof(string));
53+
var type = methodCallExpression.Object.Type.UnwrapNullableType();
54+
if (SupportedTypes.Contains(type))
55+
{
56+
return new ExplicitCastExpression(methodCallExpression.Object, typeof(string));
57+
}
58+
else if (type == typeof(Guid))
59+
{
60+
return new SqlFunctionExpression("UUID_TO_CHAR", typeof(string), new[] { methodCallExpression.Object });
61+
}
5562
}
5663
return null;
5764
}

0 commit comments

Comments
 (0)