Tolitech.Infrastructure.Persistence.DbConstraintValidator 1.0.0-alpha01

This is a prerelease version of Tolitech.Infrastructure.Persistence.DbConstraintValidator.
dotnet add package Tolitech.Infrastructure.Persistence.DbConstraintValidator --version 1.0.0-alpha01                
NuGet\Install-Package Tolitech.Infrastructure.Persistence.DbConstraintValidator -Version 1.0.0-alpha01                
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.DbConstraintValidator" Version="1.0.0-alpha01" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tolitech.Infrastructure.Persistence.DbConstraintValidator --version 1.0.0-alpha01                
#r "nuget: Tolitech.Infrastructure.Persistence.DbConstraintValidator, 1.0.0-alpha01"                
#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.DbConstraintValidator as a Cake Addin
#addin nuget:?package=Tolitech.Infrastructure.Persistence.DbConstraintValidator&version=1.0.0-alpha01&prerelease

// Install Tolitech.Infrastructure.Persistence.DbConstraintValidator as a Cake Tool
#tool nuget:?package=Tolitech.Infrastructure.Persistence.DbConstraintValidator&version=1.0.0-alpha01&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 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 (3)

Showing the top 3 NuGet packages that depend on Tolitech.Infrastructure.Persistence.DbConstraintValidator:

Package Downloads
Tolitech.CleanArchitecture.Infrastructure.Persistence.EntityFrameworkCore

The 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.DbConstraintValidator.SqlServer

A static library for managing and validating database constraint exceptions specifically for SQL Server.

Tolitech.Infrastructure.Persistence.DbConstraintValidator.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-alpha01 60 9/30/2024