Skip to content

Commit

Permalink
Make Alias non-nullable for selected table-like expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Nov 22, 2020
1 parent 1e0ae00 commit bba61a0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/EFCore.Relational/Query/QuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction
protected override Expression VisitTableValuedFunction(TableValuedFunctionExpression tableValuedFunctionExpression)
{
Check.NotNull(tableValuedFunctionExpression, nameof(tableValuedFunctionExpression));
Check.DebugAssert(tableValuedFunctionExpression.Alias is not null,
$"{nameof(tableValuedFunctionExpression.Alias)} is null on {nameof(tableValuedFunctionExpression)}");

if (!string.IsNullOrEmpty(tableValuedFunctionExpression.StoreFunction.Schema))
{
Expand Down
11 changes: 11 additions & 0 deletions src/EFCore.Relational/Query/SqlExpressions/FromSqlExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;
using CA = System.Diagnostics.CodeAnalysis;

#nullable enable

Expand Down Expand Up @@ -54,6 +55,16 @@ public FromSqlExpression([NotNull] string alias, [NotNull] string sql, [NotNull]
Arguments = arguments;
}

/// <summary>
/// The alias assigned to this table source.
/// </summary>
[CA.NotNull]
public override string? Alias
{
get => base.Alias!;
internal set => base.Alias = value;
}

/// <summary>
/// The user-provided custom SQL for the table source.
/// </summary>
Expand Down
11 changes: 11 additions & 0 deletions src/EFCore.Relational/Query/SqlExpressions/SetOperationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;
using CA = System.Diagnostics.CodeAnalysis;

#nullable enable

Expand Down Expand Up @@ -42,6 +43,16 @@ protected SetOperationBase(
Source2 = source2;
}

/// <summary>
/// The alias assigned to this table source.
/// </summary>
[CA.NotNull]
public override string? Alias
{
get => base.Alias!;
internal set => base.Alias = value;
}

/// <summary>
/// The bool value indicating whether result will remove duplicate rows.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;
using CA = System.Diagnostics.CodeAnalysis;

#nullable enable

Expand Down Expand Up @@ -44,6 +45,16 @@ private TableValuedFunctionExpression(string alias, IStoreFunction storeFunction
Arguments = arguments;
}

/// <summary>
/// The alias assigned to this table source.
/// </summary>
[CA.NotNull]
public override string? Alias
{
get => base.Alias!;
internal set => base.Alias = value;
}

/// <summary>
/// The store function.
/// </summary>
Expand Down

0 comments on commit bba61a0

Please sign in to comment.