Class EfOperations
- Namespace
- Ando.Operations
- Assembly
- ando.dll
Provides Entity Framework Core CLI operations for database management. Uses 'dotnet ef' tool for migrations and database updates.
public class EfOperations : OperationsBase
- Inheritance
-
EfOperations
- Inherited Members
Constructors
EfOperations(StepRegistry, IBuildLogger, Func<ICommandExecutor>)
Provides Entity Framework Core CLI operations for database management. Uses 'dotnet ef' tool for migrations and database updates.
public EfOperations(StepRegistry registry, IBuildLogger logger, Func<ICommandExecutor> executorFactory)
Parameters
registryStepRegistryloggerIBuildLoggerexecutorFactoryFunc<ICommandExecutor>
Methods
DatabaseUpdate(EfContextRef, OutputRef)
Registers a step to apply pending migrations to the database. Uses a connection string from a Bicep deployment output.
public void DatabaseUpdate(EfContextRef context, OutputRef connectionString)
Parameters
contextEfContextRefDbContext reference.
connectionStringOutputRefConnection string output from a Bicep deployment.
DatabaseUpdate(EfContextRef, string?)
Registers a step to apply pending migrations to the database.
public void DatabaseUpdate(EfContextRef context, string? connectionString = null)
Parameters
contextEfContextRefDbContext reference.
connectionStringstringOptional connection string override.
DbContextFrom(ProjectRef, string)
Creates a reference to a DbContext in a project. Does not register a step - just creates a reference for use with other methods.
public EfContextRef DbContextFrom(ProjectRef project, string contextName = "default")
Parameters
projectProjectRefProject containing the DbContext.
contextNamestringDbContext class name, or "default" for single-context projects.
Returns
Script(EfContextRef, BuildPath, string?)
Registers a step to generate an idempotent SQL script from migrations. Idempotent scripts can be safely re-run without causing errors.
public void Script(EfContextRef context, BuildPath outputFile, string? fromMigration = null)
Parameters
contextEfContextRefDbContext reference.
outputFileBuildPathPath for the output SQL file.
fromMigrationstringOptional starting migration (for partial scripts).