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

Consolidate terminate overloads in MigrationsSqlGenerator #16673

Merged
merged 1 commit into from
Jul 20, 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
171 changes: 11 additions & 160 deletions src/EFCore.Relational/Migrations/MigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,6 @@ protected virtual void Generate(
generateAction(this, operation, model, builder);
}

/// <summary>
/// Builds commands for the given <see cref="AddColumnOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] AddColumnOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="AddColumnOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -178,7 +165,7 @@ protected virtual void Generate(
[NotNull] AddColumnOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand All @@ -204,19 +191,6 @@ protected virtual void Generate(
}
}

/// <summary>
/// Builds commands for the given <see cref="AddForeignKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] AddForeignKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="AddForeignKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -229,7 +203,7 @@ protected virtual void Generate(
[NotNull] AddForeignKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand All @@ -248,19 +222,6 @@ protected virtual void Generate(
}
}

/// <summary>
/// Builds commands for the given <see cref="AddPrimaryKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] AddPrimaryKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="AddPrimaryKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -273,7 +234,7 @@ protected virtual void Generate(
[NotNull] AddPrimaryKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down Expand Up @@ -469,19 +430,6 @@ protected virtual void Generate(
throw new NotImplementedException();
}

/// <summary>
/// Builds commands for the given <see cref="CreateIndexOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] CreateIndexOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="CreateIndexOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -494,7 +442,7 @@ protected virtual void Generate(
[NotNull] CreateIndexOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down Expand Up @@ -589,19 +537,6 @@ protected virtual void Generate(
EndStatement(builder);
}

/// <summary>
/// Builds commands for the given <see cref="CreateTableOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] CreateTableOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="CreateTableOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -614,7 +549,7 @@ protected virtual void Generate(
[NotNull] CreateTableOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down Expand Up @@ -645,19 +580,6 @@ protected virtual void Generate(
}
}

/// <summary>
/// Builds commands for the given <see cref="DropColumnOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] DropColumnOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="DropColumnOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -670,7 +592,7 @@ protected virtual void Generate(
[NotNull] DropColumnOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand All @@ -688,19 +610,6 @@ protected virtual void Generate(
}
}

/// <summary>
/// Builds commands for the given <see cref="DropForeignKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] DropForeignKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="DropForeignKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -713,7 +622,7 @@ protected virtual void Generate(
[NotNull] DropForeignKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand All @@ -731,25 +640,6 @@ protected virtual void Generate(
}
}

/// <summary>
/// <para>
/// Can be overridden by database providers to build commands for the given <see cref="DropIndexOperation" />
/// by making calls on the given <see cref="MigrationCommandListBuilder" />.
/// </para>
/// <para>
/// Note that the default implementation of this method throws <see cref="NotImplementedException" />. Providers
/// must override if they are to support this kind of operation.
/// </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>
protected virtual void Generate(
[NotNull] DropIndexOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// <para>
/// Can be overridden by database providers to build commands for the given <see cref="DropIndexOperation" />
Expand All @@ -768,24 +658,11 @@ protected virtual void Generate(
[NotNull] DropIndexOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
throw new NotImplementedException();
}

/// <summary>
/// Builds commands for the given <see cref="DropPrimaryKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] DropPrimaryKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="DropPrimaryKeyOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -798,7 +675,7 @@ protected virtual void Generate(
[NotNull] DropPrimaryKeyOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down Expand Up @@ -862,19 +739,6 @@ protected virtual void Generate(
EndStatement(builder);
}

/// <summary>
/// Builds commands for the given <see cref="DropTableOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] DropTableOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="DropTableOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -887,7 +751,7 @@ protected virtual void Generate(
[NotNull] DropTableOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down Expand Up @@ -1042,19 +906,6 @@ protected virtual void Generate(
EndStatement(builder, operation.SuppressTransaction);
}

/// <summary>
/// Builds commands for the given <see cref="InsertDataOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />, and then terminates the final command.
/// </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>
protected virtual void Generate(
[NotNull] InsertDataOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder)
=> Generate(operation, model, builder, terminate: true);

/// <summary>
/// Builds commands for the given <see cref="InsertDataOperation" /> by making calls on the given
/// <see cref="MigrationCommandListBuilder" />.
Expand All @@ -1067,7 +918,7 @@ protected virtual void Generate(
[NotNull] InsertDataOperation operation,
[CanBeNull] IModel model,
[NotNull] MigrationCommandListBuilder builder,
bool terminate)
bool terminate = true)
{
Check.NotNull(operation, nameof(operation));
Check.NotNull(builder, nameof(builder));
Expand Down
Loading