Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor comment support #16828

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ protected virtual void Generate(

ColumnDefinition(operation, model, builder);

if (operation.Comment != null)
{
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator);

GenerateComment(operation, model, builder, operation.Comment, operation.Schema, operation.Table, operation.Name);
}

if (terminate)
{
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator);
Expand Down Expand Up @@ -568,16 +561,6 @@ protected virtual void Generate(

builder.Append(")");

if (operation.Comment != null)
{
GenerateComment(operation, model, builder, operation.Comment, operation.Schema, operation.Name);
}

foreach (var column in operation.Columns.Where(c => c.Comment != null))
{
GenerateComment(operation, model, builder, column.Comment, operation.Schema, operation.Name, column.Name);
}

if (terminate)
{
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator);
Expand Down Expand Up @@ -1633,35 +1616,6 @@ protected virtual void EndStatement(
builder.EndCommand(suppressTransaction);
}

/// <summary>
/// <para>
/// Can be overridden by database providers to build commands for applying comments to tables and columns
/// by making calls on the given <see cref="MigrationCommandListBuilder" />.
/// </para>
/// <para>
/// Note that the default implementation of this method does nothing because there is no common metadata
/// relating to this operation. Providers only need to override this method if they have some provider-specific
/// annotations that must be handled.
/// </para>
/// </summary>
/// <param name="operation"> The operation. </param>
/// <param name="model"> The target model which may be <c>null</c> if the operations exist without a model. </param>
/// <param name="builder"> The command builder to use to build the commands. </param>
/// <param name="comment"> The comment to be applied. </param>
/// <param name="schema"> The schema of the table. </param>
/// <param name="table"> The name of the table. </param>
/// <param name="columnName"> The column name if comment is being applied to a column. </param>
protected virtual void GenerateComment(
[NotNull] MigrationOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
[NotNull] string comment,
[NotNull] string schema,
[NotNull] string table,
[CanBeNull] string columnName = null)
{
}

/// <summary>
/// Concatenates the given column names into a <see cref="ISqlGenerationHelper.DelimitIdentifier(string)" />
/// separated list.
Expand Down
Loading