Class MigrationCommandListBuilder
- Namespace
- Microsoft.EntityFrameworkCore.Migrations
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A builder for creating a list of MigrationCommands that can then be executed to migrate a database.
public class MigrationCommandListBuilder
- Inheritance
-
MigrationCommandListBuilder
- Inherited Members
Constructors
MigrationCommandListBuilder(MigrationsSqlGeneratorDependencies)
Creates a new instance of the builder.
public MigrationCommandListBuilder(MigrationsSqlGeneratorDependencies dependencies)
Parameters
dependencies
MigrationsSqlGeneratorDependenciesDependencies needed for SQL generations.
Methods
Append(string)
Appends the given string to the command being built.
public virtual MigrationCommandListBuilder Append(string o)
Parameters
o
stringThe string to append.
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
AppendLine()
Starts a new line on the command being built.
public virtual MigrationCommandListBuilder AppendLine()
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
AppendLine(string)
Appends the given string to the command being built, and then starts a new line.
public virtual MigrationCommandListBuilder AppendLine(string value)
Parameters
value
stringThe string to append.
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
AppendLines(string)
Appends the given object to the command being built as multiple lines of text. That is, each line in the passed string is added as a line to the command being built. This results in the lines having the correct indentation.
public virtual MigrationCommandListBuilder AppendLines(string value)
Parameters
value
stringThe string to append.
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
DecrementIndent()
Decreases the current indentation by one level.
public virtual MigrationCommandListBuilder DecrementIndent()
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
EndCommand(bool)
Ends the building of the current command and adds it to the list of built commands. The next call to one of the builder methods will start building a new command.
public virtual MigrationCommandListBuilder EndCommand(bool suppressTransaction = false)
Parameters
suppressTransaction
boolIndicates whether or not transactions should be suppressed while executing the built command.
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
GetCommandList()
Gets the list of built commands.
public virtual IReadOnlyList<MigrationCommand> GetCommandList()
Returns
- IReadOnlyList<MigrationCommand>
The MigrationCommands that have been built.
IncrementIndent()
Increases the current indentation by one level.
public virtual MigrationCommandListBuilder IncrementIndent()
Returns
- MigrationCommandListBuilder
This builder so that additional calls can be chained.
Indent()
Starts a new indentation block, so all 'Append...' calls until the block is disposed will be indented one level more than the current level.
public virtual IDisposable Indent()
Returns
- IDisposable
The object to dispose to indicate that the indentation should go back up a level.