Kritikos.Configuration.Persistence 2.1.0

dotnet add package Kritikos.Configuration.Persistence --version 2.1.0                
NuGet\Install-Package Kritikos.Configuration.Persistence -Version 2.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kritikos.Configuration.Persistence" Version="2.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kritikos.Configuration.Persistence --version 2.1.0                
#r "nuget: Kritikos.Configuration.Persistence, 2.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kritikos.Configuration.Persistence as a Cake Addin
#addin nuget:?package=Kritikos.Configuration.Persistence&version=2.1.0

// Install Kritikos.Configuration.Persistence as a Cake Tool
#tool nuget:?package=Kritikos.Configuration.Persistence&version=2.1.0                

Configuration.Persistence

Build Status codecov Coverage Status Quality Gate Status License GitHub language count GitHub top language

Starting point and useful extensions to handle database persistence via Entity Framework Core.

Persistence Abstractions

  • IEntity<TKey> marks and groups primary entities in project having a primary key of type TKey
  • IConcurrent provides RowVersion used by Microsoft SQL Server for database concurrency
  • ITimestamped and IAuditable<T> handle audit records and are compatible with provided interceptors

Examples can be found in BasicEntity, ConcurrentEntity and Entity.

Interceptors

A set of pre-transaction interceptors that provide helper functions. Current list includes:

  • AuditSaveChangesInterceptor: provides auditing for create/update events, requires an implementation of IAuditorProvider in order to work
  • ITimeStampSaveChangesInterceptor: populates fields provided by ITimestamped, auditing create and update dates of each record
  • ReadOnlyDbCommandInterceptor: turns a database readonly by supressing all actions in SaveChanges

Services

  • MigrationService<TContext> is an oneshot HostedService that enforces database migration before kestrel starts serving requests.

Extensions

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.

Additional Features

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.

Converters

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
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Kritikos.Configuration.Persistence:

Package Downloads
Kritikos.Configuration.Peristence.IdentityServer

A simple shim of ApiAuthorizationDbContext, allowing usage of the generic IdentityDbContext<TUser,TRole,TKey> with IdentityServer extension methods on .net 5

Kritikos.Configuration.Persistence.Interceptors

Interceptors handling common usecase scenarios such us read-only db context, automatic auditing, timestamping

Kritikos.Configuration.Persistence.Converters

ValueConverters for use with EF Core, handle responsibly.

Kritikos.Configuration.Persistence.AspNetCore

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 260 9/25/2023
2.0.0 1,315 5/12/2021
1.1.1 1,282 4/13/2021
1.1.0 611 4/8/2021
1.0.1 644 4/7/2021
1.0.0 581 4/7/2021
0.1.9 603 3/2/2021
0.1.8 518 8/2/2020
0.1.7 544 1/2/2020