Skip to content

Latest commit

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Here is a comprehensive summary of the NDF (Net Delivery Framework) solution:


Net Delivery Framework (NDF) — Solution Summary

Repository:https://github.com/CodeFactoryLLC/NDFAuthor: CodeFactory, LLC. | License: MIT | Version: 10.26141.1


Solution Overview

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.


Projects

1. CodeFactory.NDF — Core Library

NuGet:CodeFactory.NDFTarget Frameworks:.NET Standard 2.1, .NET 10.0

The foundational library for the framework. All other NDF libraries depend on this package.

Features

Managed Exception Hierarchy

A structured, application-safe exception system built on a common ManagedException base class. Exceptions surface user-friendly messages without leaking internal details.

Exception ClassBase ClassPurpose
ManagedExceptionSystem.ExceptionRoot base for all managed exceptions
ManagedExceptionsManagedExceptionAggregates multiple exceptions into one
CommunicationExceptionManagedExceptionCommunication failures between services
ConfigurationExceptionManagedExceptionMissing or invalid configuration
DataExceptionManagedExceptionData operation errors
LogicExceptionManagedExceptionApplication logic errors
SecurityExceptionManagedExceptionSecurity-related errors
UnhandledExceptionManagedExceptionWraps unexpected exceptions safely
ValidationExceptionManagedExceptionInput data validation failures (+ DataField property)
AuthenticationExceptionSecurityExceptionAuthentication failures
AuthorizationExceptionSecurityExceptionAuthorization/access-control failures
DataValidationExceptionDataExceptionProperty-level data validation (+ PropertyName property)
DuplicateExceptionDataExceptionDuplicate data detection
Structured Logging Extensions (LoggingExtensions)

Extension methods on ILogger that automatically inject caller metadata (member name, line number) into log output via [CallerMemberName] and [CallerLineNumber].

MethodDescription
EnterLogLogs entry into a member at the specified log level
ExitLogLogs exit from a member at the specified log level

Compatible with structured log sinks such as Serilog and Application Insights.

Dependency Injection Loader (DependencyInjectionLoader)

An abstract base class for library-level DI registration. Supports a layered, composable loading pipeline:

Override MethodPurpose
LoadLibrariesLoad registrations from dependent child libraries
LoadManualRegistrationRegister services needing manual/conditional setup
LoadRegistrationPrimary service registrations for the library

Dependencies

PackageVersion
Microsoft.Extensions.Configuration.Abstractions10.0.0
Microsoft.Extensions.DependencyInjection.Abstractions10.0.0
Microsoft.Extensions.Logging.Abstractions10.0.0
System.Collections.Immutable(netstandard2.1 only)10.0.0

2. CodeFactory.NDF.SQL — SQL Support Library

NuGet:CodeFactory.NDF.SQLTarget 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.

Features

SQL Exception Management (SqlExceptionManagement)

A static class with extension methods that map SqlException error numbers to the appropriate NDF managed exception.

MethodDescription
ThrowManagedException(this SqlException source)Evaluates the SQL error number and throws the corresponding NDF managed exception
SQL Error-to-Exception Mapping
SQL ErrorConditionNDF Exception
18456, 18470Auth failure / Account disabledAuthenticationException
229, 230, 262Permission deniedAuthorizationException
10060, 53, 10054Connection/network failureCommunicationException
-2TimeoutCommunicationTimeoutException
4060Cannot open databaseConfigurationException
2601, 2627Duplicate / unique key violationDuplicateException
515, 8152NULL insert / data truncationDataValidationException
547Foreign key constraintValidationException
1205Deadlock victimDataException
(all others)Unknown SQL errorDataException
SQL Error Number Constants

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.

Dependencies

PackageVersion
CodeFactory.NDF(project reference)
Microsoft.Data.SqlClient7.0.1

⚠️.NET Standard 2.1 support was removed in version 10.x. Use an earlier version if Standard 2.1 is required.


Solution Structure

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

API Documentation

Full API docs are published at: https://codefactoryllc.github.io/NDF

About

Net Delivery Framework

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages