OGA.InfraBase
3.5.6
dotnet add package OGA.InfraBase --version 3.5.6
NuGet\Install-Package OGA.InfraBase -Version 3.5.6
<PackageReference Include="OGA.InfraBase" Version="3.5.6" />
paket add OGA.InfraBase --version 3.5.6
#r "nuget: OGA.InfraBase, 3.5.6"
// Install OGA.InfraBase as a Cake Addin #addin nuget:?package=OGA.InfraBase&version=3.5.6 // Install OGA.InfraBase as a Cake Tool #tool nuget:?package=OGA.InfraBase&version=3.5.6
OGA.InfraBase
Base Infrastructure Class Library, providing persistence to domain model
Description
This library provides classes to facilitate EF persistence, pagination support for mapping model to DTO, and dbcontext-backed configuration storage.
Specifically, this library was put together to be referenced by your app-specific domain service layer, making persistence and DTO mapping easier.
This library includes the following classes and elements that can be consumed:
- Pagination classes for domain queries that require server-side pagination.
These classes support pagination needs for Next/Last URLs, and entity mapping to DTO types, using AutoMapper. - A Uri Service implementation that can compose URL strings for pagination, and any other sort/filtering passed as query-parameter.
- A Config Service for process configuration mapping key-value type access into a backing table.
It includes both In-Memory and DbContext support, with a common interface, so you can easily perform unit-testing without a backend. - A Config Update Service that provides runtime R/W access to application settings and build data stored in a process' appsettings.json file.
This can be used by diagnostic API calls to retrieve version, source control info, etc, for the process.
This library leverages the functionality of OGA.AppSettings.Writeable, to provide runtime write access to appsettings.json. - A generic Repository class, providing the majority of access and update methods to entity types that derive from IAggregateRoot<>.
This class type can be used by generic API controllers, for domain model access without entity-specific code. - A data context base that is able to set creation and modified timestamps of saved entities, and correctly retrieve datetimes from a database backend, as UTC (when stored as UCT).
- A data context extension that bolts on key-value storage capability.
- A data context extension that bolts on an ability to determine if all migrations are applied, and to retrieve a list of pending migrations, waiting to update storage.
- A data context attribute that marks storage-specific data contexts with their specific storage type: MSSQL, PostGres, InMemory.
This allows us to retrieve derived data contexts from a simple process assembly search, and apply the correct access config (host/user/pw) for the specific storage provider. - A DataTime UTC Value Converter that sets the UTC Kind flag of a given retrieved DateTime.
This value converter can be quickly used in property-tablecolumn mappings of an IEntityTypeConfiguration<> implementation.
This is especially used for any datetime stored in MSSQL, because the SQL Server storage provider does not set the UTC flag of retrieved DateTimes, if they were stored in UTC.
Installation
OGA.InfraBase is available via NuGet:
Dependencies
This library depends on:
- AutoMapper
- Microsoft.EntityFrameworkCore
- NLog
- OGA.AppSettings.Writeable
- OGA.DomainBase
- OGA.SharedKernel
Building OGA.InfraBase
This library is built with the new SDK-style projects. It contains multiple projects, one for each of the following frameworks:
- NET 5
- NET 6
- NET 7
And, the output nuget package includes runtimes targets for:
- linux-any
- win-any
Framework and Runtime Support
Currently, the nuget package of this library supports the framework versions and runtimes of applications that I maintain (see above). If someone needs others (older or newer), let me know, and I'll add them to the build script.
Visual Studio
This library is currently built using Visual Studio 2019 17.1.
License
Please see the License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 is compatible. 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 was computed. 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. |
-
net5.0
- AutoMapper (>= 12.0.0)
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 5.0.17)
- OGA.AppSettings.Writeable (>= 1.8.3)
- OGA.DomainBase (>= 2.2.5)
- OGA.SharedKernel (>= 3.5.4)
-
net6.0
- AutoMapper (>= 12.0.0)
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.0)
- Microsoft.EntityFrameworkCore.InMemory (>= 6.0.9)
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.9)
- OGA.AppSettings.Writeable (>= 1.8.3)
- OGA.DomainBase (>= 2.2.5)
- OGA.SharedKernel (>= 3.5.4)
-
net7.0
- AutoMapper (>= 12.0.0)
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.0)
- Microsoft.EntityFrameworkCore.InMemory (>= 6.0.9)
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.9)
- OGA.AppSettings.Writeable (>= 1.8.3)
- OGA.DomainBase (>= 2.2.5)
- OGA.SharedKernel (>= 3.5.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
(Please write the package release notes in "OGA.InfraBase-RELEASE_NOTES.txt".)