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
<PackageReference Include="CodeFactory.NDF.SQL" Version="10.26141.1" />
<PackageVersion Include="CodeFactory.NDF.SQL" Version="10.26141.1" />
<PackageReference Include="CodeFactory.NDF.SQL" />
paket add CodeFactory.NDF.SQL --version 10.26141.1
#r "nuget: CodeFactory.NDF.SQL, 10.26141.1"
#:package CodeFactory.NDF.SQL@10.26141.1
#addin nuget:?package=CodeFactory.NDF.SQL&version=10.26141.1
#tool nuget:?package=CodeFactory.NDF.SQL&version=10.26141.1
CodeFactory.NDF.SQL
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,ConnectionResetNumberTimeoutNumberAuthenticationErrorNumber,AccountDisabledNumberPermissionDeniedNumber,ColumnPermissionDeniedNumber,CreatePermissionDeniedNumberCannotOpenDatabaseNumberCannotInsertNullNumber,ForeignKeyConstraintNumber,DataTruncationNumberDeadlockNumberDuplicateEntryNumber,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 | Versions 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. |
-
net10.0
- CodeFactory.NDF (>= 10.26141.1)
- Microsoft.Data.SqlClient (>= 7.0.1)
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.