diff --git a/src/EFCore.Relational/Query/ISqlExpressionFactory.cs b/src/EFCore.Relational/Query/ISqlExpressionFactory.cs index f5e6b167b9e..1f56ab412fe 100644 --- a/src/EFCore.Relational/Query/ISqlExpressionFactory.cs +++ b/src/EFCore.Relational/Query/ISqlExpressionFactory.cs @@ -445,7 +445,7 @@ SqlFunctionExpression Function( /// The associated with the expression. /// An expression representing a function call in a SQL tree. SqlFunctionExpression Function( - [NotNull] string schema, + [CanBeNull] string? schema, [NotNull] string name, [NotNull] IEnumerable arguments, bool nullable, diff --git a/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs b/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs index cebc9d6da91..5c4547c9afd 100644 --- a/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs +++ b/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs @@ -88,17 +88,7 @@ public RelationalMethodCallTranslatorProvider([NotNull] RelationalMethodCallTran var argumentsPropagateNullability = dbFunction.Parameters.Select(p => p.PropagatesNullability); - if (dbFunction.IsBuiltIn) - { - return _sqlExpressionFactory.Function( - dbFunction.Name, - arguments, - dbFunction.IsNullable, - argumentsPropagateNullability, - method.ReturnType.UnwrapNullableType()); - } - - return dbFunction.Schema is null + return dbFunction.IsBuiltIn ? _sqlExpressionFactory.Function( dbFunction.Name, arguments, diff --git a/src/EFCore.Relational/Query/SqlExpressionFactory.cs b/src/EFCore.Relational/Query/SqlExpressionFactory.cs index ebda99e7b00..0ccb5368495 100644 --- a/src/EFCore.Relational/Query/SqlExpressionFactory.cs +++ b/src/EFCore.Relational/Query/SqlExpressionFactory.cs @@ -636,7 +636,7 @@ public virtual SqlFunctionExpression Function( /// public virtual SqlFunctionExpression Function( - string schema, + string? schema, string name, IEnumerable arguments, bool nullable, @@ -644,7 +644,7 @@ public virtual SqlFunctionExpression Function( Type returnType, RelationalTypeMapping? typeMapping = null) { - Check.NotNull(schema, nameof(schema)); + Check.NullButNotEmpty(schema, nameof(schema)); Check.NotEmpty(name, nameof(name)); Check.NotNull(arguments, nameof(arguments)); Check.NotNull(argumentsPropagateNullability, nameof(argumentsPropagateNullability));