Interface IMigrationsSqlGenerator
- Namespace
- Microsoft.EntityFrameworkCore.Migrations
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A service for generating MigrationCommand objects that can then be executed or scripted from a list of MigrationOperations.
public interface IMigrationsSqlGenerator
Remarks
The service lifetime is Scoped. This means that each Microsoft.EntityFrameworkCore.DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.
See Database migrations for more information and examples.
Methods
Generate(IReadOnlyList<MigrationOperation>, IModel?, MigrationsSqlGenerationOptions)
Generates commands from a list of operations.
IReadOnlyList<MigrationCommand> Generate(IReadOnlyList<MigrationOperation> operations, IModel? model = null, MigrationsSqlGenerationOptions options = MigrationsSqlGenerationOptions.Default)
Parameters
operations
IReadOnlyList<MigrationOperation>The operations.
model
IModelThe target model which may be null if the operations exist without a model.
options
MigrationsSqlGenerationOptionsThe options to use when generating commands.
Returns
- IReadOnlyList<MigrationCommand>
The list of commands to be executed or scripted.