Here is a comprehensive summary of the NDF (Net Delivery Framework) solution:
Repository: https://github.com/CodeFactoryLLC/NDF Author: CodeFactory, LLC. | License: MIT | Version: 10.26141.1
The NDF solution provides reusable delivery framework patterns for .NET solutions. It is composed of two NuGet-published class library projects that implement consistent exception handling, structured logging, and dependency injection patterns.
NuGet: CodeFactory.NDF
Target Frameworks: .NET Standard 2.1, .NET 10.0
The foundational library for the framework. All other NDF libraries depend on this package.
A structured, application-safe exception system built on a common ManagedException base class. Exceptions surface user-friendly messages without leaking internal details.
| Exception Class | Base Class | Purpose |
|---|---|---|
ManagedException |
System.Exception |
Root base for all managed exceptions |
ManagedExceptions |
ManagedException |
Aggregates multiple exceptions into one |
CommunicationException |
ManagedException |
Communication failures between services |
ConfigurationException |
ManagedException |
Missing or invalid configuration |
DataException |
ManagedException |
Data operation errors |
LogicException |
ManagedException |
Application logic errors |
SecurityException |
ManagedException |
Security-related errors |
UnhandledException |
ManagedException |
Wraps unexpected exceptions safely |
ValidationException |
ManagedException |
Input data validation failures (+ DataField property) |
AuthenticationException |
SecurityException |
Authentication failures |
AuthorizationException |
SecurityException |
Authorization/access-control failures |
DataValidationException |
DataException |
Property-level data validation (+ PropertyName property) |
DuplicateException |
DataException |
Duplicate data detection |
Extension methods on ILogger that automatically inject caller metadata (member name, line number) into log output via [CallerMemberName] and [CallerLineNumber].
| Method | Description |
|---|---|
EnterLog |
Logs entry into a member at the specified log level |
ExitLog |
Logs exit from a member at the specified log level |
Compatible with structured log sinks such as Serilog and Application Insights.
An abstract base class for library-level DI registration. Supports a layered, composable loading pipeline:
| Override Method | Purpose |
|---|---|
LoadLibraries |
Load registrations from dependent child libraries |
LoadManualRegistration |
Register services needing manual/conditional setup |
LoadRegistration |
Primary service registrations for the library |
| Package | Version |
|---|---|
Microsoft.Extensions.Configuration.Abstractions |
10.0.0 |
Microsoft.Extensions.DependencyInjection.Abstractions |
10.0.0 |
Microsoft.Extensions.Logging.Abstractions |
10.0.0 |
System.Collections.Immutable (netstandard2.1 only) |
10.0.0 |
NuGet: CodeFactory.NDF.SQL
Target Framework: .NET 10.0 only
A supplemental library providing structured MS SQL Server integration. Translates raw SqlException errors into the NDF managed exception hierarchy — eliminating boilerplate data-layer error handling.
A static class with extension methods that map SqlException error numbers to the appropriate NDF managed exception.
| Method | Description |
|---|---|
ThrowManagedException(this SqlException source) |
Evaluates the SQL error number and throws the corresponding NDF managed exception |
| SQL Error | Condition | NDF Exception |
|---|---|---|
18456, 18470 |
Auth failure / Account disabled | AuthenticationException |
229, 230, 262 |
Permission denied | AuthorizationException |
10060, 53, 10054 |
Connection/network failure | CommunicationException |
-2 |
Timeout | CommunicationTimeoutException |
4060 |
Cannot open database | ConfigurationException |
2601, 2627 |
Duplicate / unique key violation | DuplicateException |
515, 8152 |
NULL insert / data truncation | DataValidationException |
547 |
Foreign key constraint | ValidationException |
1205 |
Deadlock victim | DataException |
| (all others) | Unknown SQL error | DataException |
All known SQL error numbers are exposed as public const int fields (e.g., ConnectionFailureNumber, TimeoutNumber, DeadlockNumber) for use in custom switch statements or logging.
| Package | Version |
|---|---|
CodeFactory.NDF |
(project reference) |
Microsoft.Data.SqlClient |
7.0.1 |
⚠️ .NET Standard 2.1support was removed in version10.x. Use an earlier version if Standard 2.1 is required.
NDF-Solution/
├── CodeFactory.NDF/ # Core framework library (netstandard2.1 + net10.0)
│ ├── ManagedException.cs
│ ├── LoggingExtensions.cs
│ ├── DependencyInjectionLoader.cs
│ └── StandardExceptionMessages.resx
├── CodeFactory.NDF.SQL/ # SQL integration library (net10.0)
│ └── SqlExceptionManagement.cs
└── NDF-Solution.sln
Full API docs are published at: https://codefactoryllc.github.io/NDF