AdaptiveClient.EntityFrameworkCore
Utility classes and methods for using AdaptiveClient to work with DBContext and other Entity Framework Core objects. Build loosely coupled services, readily accessible via a lightweight façade. Easily build your service layer to use multiple providers (MSSQL, MySQL, SQLite) with no additional infrastructure. Use connection string objects to as keys to resolve specific implementations of DbContext for migrations and testing.
Install / Use
/learn @leaderanalytics/AdaptiveClient.EntityFrameworkCoreREADME
AdaptiveClient.EntityFrameworkCore
Utilities for using AdaptiveClient to work with DBContext and migrations.
Get the Nuget package
Change log
2024-11-29 v5 - Migrate to .net 9 / EF 9.
2022-12-27 v4 - Migrate to .net 7 / EF 7.
2021-02-07 v2.0.0 - Migrate to .net 5. Drop support for .net framework. Update Entity Framework dependencies to EF Core 5.
Classes
DatabaseUtilities
- Use an
IEndPointConfigurationto resolve aDbContext. Check status of resolvedDbContextor perform other operations such as applying migrations or dropping the database.
DatabaseValidationResult
- Returns names of applied migrations, if any, and if database was created.
Structures
DatabaseStatus
- Enum that provides status of a given database: Unknown, DoesNotExist, NotConsistentWithModel, ConsistentWithModel.
Interfaces
IDataBaseUtilities
- Methods for resolving and working with DbContext. See
DatabaseUtilitiesimplementation.
IDatabaseInitializer
- Method for seeding a database when it is created or when a migration is applied.
IDbContextOptions
- An interface for keying DbContextOptions.
IMigrationContext
- A placeholder interface for keying a MigrationContext
RegistrationHelper Extensions
- RegisterDbContext - Keys a class derived from
DbContextto an API_Name. - RegisterDbContextOptions - Keys a class that implements IDbContextOptions to a specific provider such as MSSQL or MySQL.
- RegisterMigrationContext - Allows EntityFramework to reflect on an assembly and resolve a DbContext to a specific provider such as MSSQL or MySQL.
- RegisterDatabaseInitializer - Keys a class that provides initialization services such as seeding a newly created database.
ResolutionHelper Extensions
- ResolveDbContext - Resolves a
DbContextinstance using keys provided by aIEndPointConfigurationparameter. - ResolveDbContextOptions - Resolves an instance of
DbContextOptionsusing keys provided by aIEndPointConfigurationparameter. - ResolveMigrationContext - Resolves an implementation of
IMigrationContextusing keys provided by aIEndPointConfigurationparameter. - ResolveDatabaseInitializer - Resolves an implementation of
IDatabaseInitalizerusing keys provided by aIEndPointConfigurationparameter.
Languages
Security Score
Audited on Dec 4, 2024
