AlirezaMahDev.Extensions.Abstractions 0.0.1-alpha7

This is a prerelease version of AlirezaMahDev.Extensions.Abstractions.
dotnet add package AlirezaMahDev.Extensions.Abstractions --version 0.0.1-alpha7
                    
NuGet\Install-Package AlirezaMahDev.Extensions.Abstractions -Version 0.0.1-alpha7
                    
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="AlirezaMahDev.Extensions.Abstractions" Version="0.0.1-alpha7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AlirezaMahDev.Extensions.Abstractions" Version="0.0.1-alpha7" />
                    
Directory.Packages.props
<PackageReference Include="AlirezaMahDev.Extensions.Abstractions" />
                    
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 AlirezaMahDev.Extensions.Abstractions --version 0.0.1-alpha7
                    
#r "nuget: AlirezaMahDev.Extensions.Abstractions, 0.0.1-alpha7"
                    
#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 AlirezaMahDev.Extensions.Abstractions@0.0.1-alpha7
                    
#: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=AlirezaMahDev.Extensions.Abstractions&version=0.0.1-alpha7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AlirezaMahDev.Extensions.Abstractions&version=0.0.1-alpha7&prerelease
                    
Install as a Cake Tool

AlirezaMahDev.Extensions.Abstractions

Project Description

This project serves as the foundation for the AlirezaMahDev.Extensions ecosystem, providing essential abstractions and interfaces that enable consistent and type-safe configuration patterns across all extension libraries. It defines the core contracts for implementing the builder pattern with dependency injection and options configuration in .NET applications.

Dependencies

Core Dependencies

  • Microsoft.Extensions.Hosting.Abstractions: Provides the fundamental interfaces for .NET's hosting infrastructure.
  • JetBrains.Annotations: Enhances code quality with static analysis attributes and code annotations.

Utility Dependencies

  • CommunityToolkit.Common: Offers common utility methods and extension methods.
  • CommunityToolkit.Diagnostics: Provides guard clauses and argument validation utilities.
  • CommunityToolkit.HighPerformance: Delivers high-performance programming utilities and optimizations.

Resilience Dependencies

  • Polly: A .NET resilience and transient-fault-handling library.
  • Polly.Extensions.Http: Extends Polly with HTTP-specific resilience policies and utilities.

Key Components

IOptionsBase Interface

The IOptionsBase interface is the foundation for all configuration options in the ecosystem:

public interface IOptionsBase
{
    static abstract string Key { get; }
}

Key Features:

  • Enforces a consistent way to define configuration keys
  • Supports hierarchical configuration through key composition
  • Enables type-safe configuration binding

IBuilderBase Interface

The IBuilderBase interface hierarchy provides a fluent API for configuring services and options:

public interface IBuilderBase
{
    IServiceCollection Services { get; }
}

public interface IBuilderBase<TOptions> : IBuilderBase
    where TOptions : class, IOptionsBase
{
    OptionsBuilder<TOptions> OptionsBuilder { get; }
    
    OptionsBuilder<TSubOptions> AddSubOptions<TSubOptions>()
        where TSubOptions : class, IOptionsBase;
}

Key Features:

  • Service Collection Access: Direct access to the underlying IServiceCollection
  • Options Configuration: Type-safe configuration of options with support for validation
  • Hierarchical Options: Built-in support for nested configuration sections
  • Fluent API: Method chaining for clean and readable configuration code

Design Principles

  1. Separation of Concerns: Clear distinction between abstraction and implementation
  2. Type Safety: Compile-time checking of configuration options
  3. Extensibility: Designed to be extended for various configuration scenarios
  4. Consistency: Uniform patterns across all extension libraries
  5. Dependency Injection First: Built around .NET's built-in dependency injection

Usage Example

// Define your options class
public class MyOptions : IOptionsBase
{
    public static string Key => "MySection";
    public string Setting1 { get; set; }
    public int Setting2 { get; set; }
}

// Define your builder interface
public interface IMyBuilder : IBuilderBase<MyOptions>
{
    // Additional builder methods can be added here
}

Architecture

The project follows these architectural principles:

  • Minimal Dependencies: Only essential dependencies are included
  • Interface Segregation: Small, focused interfaces for each responsibility
  • Extension Friendly: Designed to be extended by other projects in the ecosystem
  • Testable: Interfaces make it easy to create test doubles for unit testing
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 (3)

Showing the top 3 NuGet packages that depend on AlirezaMahDev.Extensions.Abstractions:

Package Downloads
AlirezaMahDev.Extensions

Package Description

AlirezaMahDev.Extensions.File.Abstractions

Package Description

AlirezaMahDev.Extensions.ParameterInstance.Abstractions

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha7 412 12/8/2025
0.0.1-alpha 275 12/7/2025