Skip to content

Commit

Permalink
Remove special handling for concat operator
Browse files Browse the repository at this point in the history
A special string concat operator was added at some point to support
PostgreSQL (which uses || to concat strings). This is an
overridable property that is by default +.

After the introduction of a more generic GenerateOperator(), this
no longer makes - a provider that needs a special concat operator
(or any other) can simply override GenerateOperator() and do that
there without any special support from Relational.

Removing to simplify/cleanup DefaultQuerySqlGenerator.
  • Loading branch information
roji authored and smitpatel committed Mar 13, 2017
1 parent 3755d1d commit 52ff4b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 0 additions & 7 deletions src/EFCore.Relational/Query/Sql/DefaultQuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ public virtual IRelationalValueBufferFactory CreateValueBufferFactory(
/// </summary>
protected virtual IRelationalCommandBuilder Sql => _relationalCommandBuilder;

/// <summary>
/// The default string concatenation operator SQL.
/// </summary>
protected virtual string ConcatOperator => "+";

/// <summary>
/// The default true literal SQL.
/// </summary>
Expand Down Expand Up @@ -1506,8 +1501,6 @@ protected virtual string GenerateOperator([NotNull] Expression expression)
{
switch (expression.NodeType)
{
case ExpressionType.Add:
return expression.Type == typeof(string) ? " " + ConcatOperator + " " : " + ";
case ExpressionType.Extension:
{
var asStringCompareExpression = expression as StringCompareExpression;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Query.Sql.Internal
/// </summary>
public class SqliteQuerySqlGenerator : DefaultQuerySqlGenerator
{
protected override string ConcatOperator => "||";

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand All @@ -28,6 +26,15 @@ public SqliteQuerySqlGenerator(
{
}

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
protected override string GenerateOperator([NotNull] Expression expression)
=> expression.NodeType == ExpressionType.Add && expression.Type == typeof(string)
? " || "
: base.GenerateOperator(expression);

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand Down

0 comments on commit 52ff4b7

Please sign in to comment.