Tolitech.Infrastructure.Persistence.ConstraintValidator 1.0.0-preview.1

This is a prerelease version of Tolitech.Infrastructure.Persistence.ConstraintValidator.
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                
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="Tolitech.Infrastructure.Persistence.ConstraintValidator" Version="1.0.0-preview.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tolitech.Infrastructure.Persistence.ConstraintValidator --version 1.0.0-preview.1                
#r "nuget: Tolitech.Infrastructure.Persistence.ConstraintValidator, 1.0.0-preview.1"                
#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 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 Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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