Tolitech.Infrastructure.Persistence.ConstraintValidator
1.0.0-preview.1
dotnet add package Tolitech.Infrastructure.Persistence.ConstraintValidator --version 1.0.0-preview.1
NuGet\Install-Package Tolitech.Infrastructure.Persistence.ConstraintValidator -Version 1.0.0-preview.1
<PackageReference Include="Tolitech.Infrastructure.Persistence.ConstraintValidator" Version="1.0.0-preview.1" />
paket add Tolitech.Infrastructure.Persistence.ConstraintValidator --version 1.0.0-preview.1
#r "nuget: Tolitech.Infrastructure.Persistence.ConstraintValidator, 1.0.0-preview.1"
// Install Tolitech.Infrastructure.Persistence.ConstraintValidator as a Cake Addin #addin nuget:?package=Tolitech.Infrastructure.Persistence.ConstraintValidator&version=1.0.0-preview.1&prerelease // Install Tolitech.Infrastructure.Persistence.ConstraintValidator as a Cake Tool #tool nuget:?package=Tolitech.Infrastructure.Persistence.ConstraintValidator&version=1.0.0-preview.1&prerelease
Tolitech.Infrastructure.Persistence.DbConstraintValidator
The Tolitech.Infrastructure.Persistence.DbConstraintValidator library offers a streamlined approach to managing and validating database constraint violations within Entity Framework Core applications. This library is designed to enhance error handling by allowing developers to define custom constraint validators that can effectively identify and respond to exceptions arising from database operations.
Features
Static Methods for Error Handling: Provides a static class, DbConstraintValidatorManager, which centralizes the handling of database constraint exceptions.
Customizable Validators: Developers can implement the IConstraintValidator interface to create custom validators tailored to specific database constraints. This enables flexibility in error handling according to the application's needs.
Efficient Exception Management: The library scans registered validators to determine if an exception is caused by a database constraint violation, returning a custom exception when necessary. If no violation is detected, the original exception is returned, maintaining the integrity of the error reporting.
Usage
Add Validators: Use the AddValidator method of DbConstraintValidatorManager to register your custom validators.
Handle Exceptions: Call the Handle method to process exceptions thrown by Entity Framework Core, allowing your application to gracefully handle constraint violations.
Installation
You can install this library via NuGet:
Install-Package Tolitech.Infrastructure.Persistence.DbConstraintValidator
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- Tolitech.Application (>= 1.0.0-preview.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Tolitech.Infrastructure.Persistence.ConstraintValidator:
Package | Downloads |
---|---|
Tolitech.Infrastructure.Persistence.EntityFrameworkCore
The Tolitech.Infrastructure.Persistence.EntityFrameworkCore repository provides a foundational implementation for the Repository pattern, Unit of Work, and Specification Query Builder using Entity Framework Core. Simplify database interaction, promote code organization, and maintenance using these widely recognized patterns. |
|
Tolitech.Infrastructure.Persistence.ConstraintValidator.SqlServer
A static library for managing and validating database constraint exceptions specifically for SQL Server. |
|
Tolitech.Infrastructure.Persistence.ConstraintValidator.PostgreSql
A static library for managing and validating database constraint exceptions specifically for PostgreSQL. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-preview.1 | 47 | 12/12/2024 |