Starting point and useful extensions to handle database persistence via Entity Framework Core.
IEntity<TKey>
marks and groups primary entities in project having a primary key of typeTKey
IConcurrent
provides RowVersion used by Microsoft SQL Server for database concurrencyITimestamped
andIAuditable<T>
handle audit records and are compatible with provided interceptors
Examples can be found in BasicEntity
, ConcurrentEntity
and Entity
.
A set of pre-transaction interceptors that provide helper functions. Current list includes:
AuditSaveChangesInterceptor
: provides auditing for create/update events, requires an implementation ofIAuditorProvider
in order to workITimeStampSaveChangesInterceptor
: populates fields provided byITimestamped
, auditing create and update dates of each recordReadOnlyDbCommandInterceptor
: turns a database readonly by supressing all actions in SaveChanges
MigrationService<TContext>
is an oneshotHostedService
that enforces database migration before kestrel starts serving requests.
Please refrain from using ChangeTracker extensions, they are considered obsolete and will be removed at some point in the future.
EntitiesOfType
is a ModelBuilder extension that allows configuring all entities inheriting common interfaces.
Library Kritikos.Configuration.Peristence.IdentityServer
contains an ApiAuthorizationDbContext wrapper for Microsoft.AspNetCore.ApiAuthorization.IdentityServer
handling the missing overload for IdentityDbContext<TUser,TRole,TKey>
.
KritikosConfiguration.Persistence.HealthCheck
offers a basic DbContext IHealthCheck for use with ASP .NET Core.
Use with care, not all converters support every available query execution at database level. Consult the documentation before applying.
- DirectoryInfo to string
- FileInfo to string
- Relative URI to string
- TimeSpan to number