Class PostgreSqlEntityFrameworkDatabaseComponent<TDbContext>
A component for an PostgreSQL database managed via Entity Framework.
The following objects are published to the environment pipeline data when using DumpRestore reset strategy:
- Type: System.String. Key: EntityFrameworkDatabaseConnectionString<TDbContext>().
The following objects are published to the environment pipeline data when using Transactions reset strategy:
- Type: Npgsql.NpgsqlConnection. Key: EntityFrameworkDatabaseConnection<TDbContext>().
- Types: IDbTransactionWallet, IDbTransactionWallet<TDbTransaction>. Key: EntityFrameworkDatabaseTransactionWallet<TDbContext>().
See PostgreSqlEntityFrameworkConfiguration for default configuration values. You can override these in your Accelergreat configuration.
Inheritance
Inherited Members
Namespace: Accelergreat.EntityFramework.PostgreSql
Assembly: Accelergreat.EntityFramework.PostgreSql.dll
Syntax
public class PostgreSqlEntityFrameworkDatabaseComponent<TDbContext> : EntityFrameworkDatabaseComponentBase<TDbContext>, IEntityFrameworkDatabaseComponent<TDbContext>, IAccelergreatComponent where TDbContext : DbContext
Type Parameters
Name | Description |
---|---|
TDbContext |
Constructors
PostgreSqlEntityFrameworkDatabaseComponent(IConfiguration)
Declaration
public PostgreSqlEntityFrameworkDatabaseComponent(IConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Configuration.IConfiguration | configuration |
Methods
ConfigureDbContextOptions(NpgsqlDbContextOptionsBuilder)
Declaration
protected virtual void ConfigureDbContextOptions(NpgsqlDbContextOptionsBuilder options)
Parameters
Type | Name | Description |
---|---|---|
Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.NpgsqlDbContextOptionsBuilder | options |
DisposeAsync(Boolean)
Declaration
protected virtual async ValueTask DisposeAsync(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Returns
Type | Description |
---|---|
ValueTask |
OnDatabaseInitializedAsync(TDbContext)
Called after the database has been created.
Override this method to persist any changes to the database that will be globally available to all tests.
Declaration
protected virtual Task OnDatabaseInitializedAsync(TDbContext context)
Parameters
Type | Name | Description |
---|---|---|
TDbContext | context |
Returns
Type | Description |
---|---|
Task |
OnDatabaseResetAsync(TDbContext)
Called after the database has been reset.
Override this method to persist any changes to the database that will be globally available to all tests.
Useful for when you have global database changes that don't persist when reset.
Most of the time you should persist global database changes via OnDatabaseInitializedAsync(TDbContext).
Declaration
protected virtual Task OnDatabaseResetAsync(TDbContext context)
Parameters
Type | Name | Description |
---|---|---|
TDbContext | context |
Returns
Type | Description |
---|---|
Task |
OnInitializing(IReadOnlyAccelergreatEnvironmentPipelineData, PostgreSqlEntityFrameworkConfiguration)
Call before the component is initialized.
Override this method to set any values on configuration
at runtime.
Declaration
protected virtual void OnInitializing(IReadOnlyAccelergreatEnvironmentPipelineData accelergreatEnvironmentPipelineData, PostgreSqlEntityFrameworkConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyAccelergreatEnvironmentPipelineData | accelergreatEnvironmentPipelineData | |
PostgreSqlEntityFrameworkConfiguration | configuration |