Table of Contents

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

registry StepRegistry
logger IBuildLogger
executorFactory Func<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

context EfContextRef

DbContext reference.

connectionString OutputRef

Connection 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

context EfContextRef

DbContext reference.

connectionString string

Optional 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

project ProjectRef

Project containing the DbContext.

contextName string

DbContext class name, or "default" for single-context projects.

Returns

EfContextRef

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

context EfContextRef

DbContext reference.

outputFile BuildPath

Path for the output SQL file.

fromMigration string

Optional starting migration (for partial scripts).