CodeFactory.NDF.SQL 10.26141.1

dotnet add package CodeFactory.NDF.SQL --version 10.26141.1
                    
NuGet\Install-Package CodeFactory.NDF.SQL -Version 10.26141.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="CodeFactory.NDF.SQL" Version="10.26141.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeFactory.NDF.SQL" Version="10.26141.1" />
                    
Directory.Packages.props
<PackageReference Include="CodeFactory.NDF.SQL" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeFactory.NDF.SQL --version 10.26141.1
                    
#r "nuget: CodeFactory.NDF.SQL, 10.26141.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.
#:package CodeFactory.NDF.SQL@10.26141.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeFactory.NDF.SQL&version=10.26141.1
                    
Install as a Cake Addin
#tool nuget:?package=CodeFactory.NDF.SQL&version=10.26141.1
                    
Install as a Cake Tool

CodeFactory.NDF.SQL

NuGet License: MIT

Net Delivery Framework (NDF) — SQL Support Library

CodeFactory.NDF.SQL is a supplemental library for the Net Delivery Framework that provides structured MS SQL Server integration for .NET applications. It translates raw SqlException errors into the NDF managed exception hierarchy, giving your data layer consistent, consumer-friendly error handling with no boilerplate.


📦 Installation

Install via the NuGet Package Manager, the .NET CLI, or the Package Manager Console.

.NET CLI

dotnet add package CodeFactory.NDF.SQL

Package Manager Console

Install-Package CodeFactory.NDF.SQL

🛠 Usage

using CodeFactory.NDF.SQL;
using System.Data.SqlClient;

public void ConnectToDatabase()
{
    try
    {
        // Your SQL Connection Logic Here
    }
    catch (SqlException ex)
    {
        // Translate and throw the managed exception
        ex.ThrowManagedException();
    }
}

Exception Mapping Reference

The following SQL error numbers are translated automatically:

SQL Error Number SQL Condition NDF Exception Thrown
18456 Authentication failure AuthenticationException
18470 Account disabled AuthenticationException
229 Permission denied (object) AuthorizationException
230 Permission denied (column) AuthorizationException
262 CREATE permission denied AuthorizationException
10060 Connection failure CommunicationException
53 Network path not found CommunicationException
10054 Connection forcibly closed CommunicationException
-2 Timeout CommunicationTimeoutException
4060 Cannot open database ConfigurationException
2601 Duplicate entry DuplicateException
2627 Unique key constraint violation DuplicateException
515 Cannot insert NULL DataValidationException
8152 String/binary data truncation DataValidationException
547 Foreign key constraint violation ValidationException
1205 Deadlock victim DataException
(all others) Unknown SQL error DataException

📚 API Reference

SqlExceptionManagement

Namespace: CodeFactory.NDF.SQL

A static class containing extension methods and constants for SQL error management.

Extension Methods
Method Description
ThrowManagedException(this SqlException source) Evaluates the SqlException error number and throws the corresponding NDF managed exception.
Error Number Constants

All known SQL error numbers are exposed as public const int fields for use in your own switch statements or logging:

  • ConnectionFailureNumber, NetworkPathNotFoundNumber, ConnectionResetNumber
  • TimeoutNumber
  • AuthenticationErrorNumber, AccountDisabledNumber
  • PermissionDeniedNumber, ColumnPermissionDeniedNumber, CreatePermissionDeniedNumber
  • CannotOpenDatabaseNumber
  • CannotInsertNullNumber, ForeignKeyConstraintNumber, DataTruncationNumber
  • DeadlockNumber
  • DuplicateEntryNumber, UniqueKeyConstraintViolationNumber

🔗 Dependencies

Package Version
CodeFactory.NDF (project reference — same version)
Microsoft.Data.SqlClient 7.0.1

📋 Requirements

  • .NET 10 or later

Note: Support for .NET Standard 2.1 has been removed as of version 10.x. Use an earlier version of this package if .NET Standard 2.1 support is required.


📄 License

This project is licensed under the MIT License.
Copyright © 2026 CodeFactory, LLC.


🏢 About CodeFactory, LLC.

CodeFactory, LLC. builds developer tooling and frameworks that accelerate enterprise .NET application delivery.
Visit us at https://github.com/CodeFactoryLLC/NDF.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.26141.1 792 5/22/2026
1.22326.1 5,908 11/22/2022

Upgraded to support .net 10. Removes support for .net Standard 2.1 on this library.