Show / Hide Table of Contents

Class SqlServerEntityFrameworkDatabaseComponent<TDbContext>

A component for an Sql Server database managed via Entity Framework.

The following objects are published to the environment pipeline data when using SnapshotRollback reset strategy:

- Type: System.String. Key: EntityFrameworkDatabaseConnectionString<TDbContext>().

The following objects are published to the environment pipeline data when using Transactions reset strategy:

- Type: Microsoft.Data.SqlClient.SqlConnection. Key: EntityFrameworkDatabaseConnection<TDbContext>().

- Types: IDbTransactionWallet, IDbTransactionWallet<TDbTransaction>. Key: EntityFrameworkDatabaseTransactionWallet<TDbContext>().

See SqlServerEntityFrameworkConfiguration for default configuration values. You can override these in your Accelergreat configuration.

Inheritance
System.Object
EntityFrameworkDatabaseComponentBase<TDbContext>
SqlServerEntityFrameworkDatabaseComponent<TDbContext>
Implements
IEntityFrameworkDatabaseComponent<TDbContext>
IAccelergreatComponent
IAsyncDisposable
Inherited Members
EntityFrameworkDatabaseComponentBase<TDbContext>.AutoRegisterGlobalDataItemsInDbContextCreation
EntityFrameworkDatabaseComponentBase<TDbContext>.GlobalDataItems
EntityFrameworkDatabaseComponentBase<TDbContext>.GlobalDataItemsOfType<T>()
EntityFrameworkDatabaseComponentBase<TDbContext>.DbContextFactory
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Accelergreat.EntityFramework.SqlServer
Assembly: Accelergreat.EntityFramework.SqlServer.dll
Syntax
public class SqlServerEntityFrameworkDatabaseComponent<TDbContext> : EntityFrameworkDatabaseComponentBase<TDbContext>, IEntityFrameworkDatabaseComponent<TDbContext>, IAccelergreatComponent where TDbContext : DbContext
Type Parameters
Name Description
TDbContext

Constructors

SqlServerEntityFrameworkDatabaseComponent(IConfiguration)

Declaration
public SqlServerEntityFrameworkDatabaseComponent(IConfiguration configuration)
Parameters
Type Name Description
Microsoft.Extensions.Configuration.IConfiguration configuration

Methods

ConfigureDbContextOptions(SqlServerDbContextOptionsBuilder)

Declaration
protected virtual void ConfigureDbContextOptions(SqlServerDbContextOptionsBuilder options)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder 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, SqlServerEntityFrameworkConfiguration)

Call before the component is initialized.

Override this method to set any values on configuration at runtime.

Declaration
protected virtual void OnInitializing(IReadOnlyAccelergreatEnvironmentPipelineData accelergreatEnvironmentPipelineData, SqlServerEntityFrameworkConfiguration configuration)
Parameters
Type Name Description
IReadOnlyAccelergreatEnvironmentPipelineData accelergreatEnvironmentPipelineData
SqlServerEntityFrameworkConfiguration configuration

Implements

IEntityFrameworkDatabaseComponent<TDbContext>
IAccelergreatComponent
IAsyncDisposable
In This Article
Back to top Copyright © Nanogunn Ltd.