Common.Infrastructure.Lib 2.0.44

There is a newer version of this package available.
See the version list below for details.
dotnet add package Common.Infrastructure.Lib --version 2.0.44
                    
NuGet\Install-Package Common.Infrastructure.Lib -Version 2.0.44
                    
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="Common.Infrastructure.Lib" Version="2.0.44" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Common.Infrastructure.Lib" Version="2.0.44" />
                    
Directory.Packages.props
<PackageReference Include="Common.Infrastructure.Lib" />
                    
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 Common.Infrastructure.Lib --version 2.0.44
                    
#r "nuget: Common.Infrastructure.Lib, 2.0.44"
                    
#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 Common.Infrastructure.Lib@2.0.44
                    
#: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=Common.Infrastructure.Lib&version=2.0.44
                    
Install as a Cake Addin
#tool nuget:?package=Common.Infrastructure.Lib&version=2.0.44
                    
Install as a Cake Tool

Common Infrastructure Library

Overview

The Common Infrastructure Library is a shared library that provides core infrastructure components for various applications. This library includes utilities and services that simplify tasks such as messaging, resilience, request context handling, and repository patterns. It is designed to be used as a NuGet package in other projects, allowing for easy integration of common functionality across multiple services.

This library provides a foundation of reusable components, reducing the need to rewrite common code in each project. It also includes enhanced resilience features for error handling, retry policies, and messaging patterns.

Key Components

Infrastructure

The Infrastructure module contains essential components and utilities that provide foundational services required by other parts of the application.

Messaging

The Messaging module offers messaging services for communication between different components or microservices. It helps in integrating messaging patterns like event-driven architecture and message queues.

Repositories

The Repositories module defines the repository pattern to abstract data access. It simplifies interaction with data sources and allows for more maintainable and testable code.

RequestContext

The RequestContext module is responsible for managing request-specific data, ensuring that relevant context is passed throughout the lifecycle of a request.

Resilience

The Resilience module adds reliability features to the application, including retry policies and circuit breaker patterns, which are critical for fault-tolerant applications.

Constants

The Constants class provides a collection of constant values used throughout the application. These constants help ensure consistency and avoid hardcoded values in the code.

Project Structure

Folders:

  • Infrastructure: Contains core infrastructure components.
  • Messaging: Provides messaging utilities and services for communication between services.
  • Repositories: Contains data access abstractions and implementations for repositories.
  • RequestContext: Provides tools to manage the request-specific data.
  • Resilience: Implements resilience patterns, such as retries and circuit breakers.
  • Constants.cs: Defines common constants used across the application.

Key Files:

  • Common.Infrastructure.csproj: The project file that defines the dependencies and structure of the library.
  • Common.Infrastructure.sln: The solution file for building and managing the project.
  • Constants.cs: A file defining constant values used across the library.

Installation

Step 1: Add the NuGet Package

You can integrate the Common Infrastructure Library into your project by adding the NuGet package:

dotnet add package Common.Infrastructure --version <version-number>

Replace <version-number> with the desired version of the package.

Step 2: Usage

Once the library is added to your project, you can use the provided classes and utilities:

  • Messaging: For sending and receiving messages between components.
  • Resilience: For adding retry policies and circuit breakers.
  • Repositories: For implementing data access layers using the repository pattern.
  • RequestContext: For accessing and managing request-specific context.
  • Constants: For reusing common constant values across the application.

Example usage in your project:

using Common.Infrastructure.Messaging;
using Common.Infrastructure.Resilience;

public class MyService
{
    private readonly IMessageService _messageService;
    private readonly IResilienceService _resilienceService;

    public MyService(IMessageService messageService, IResilienceService resilienceService)
    {
        _messageService = messageService;
        _resilienceService = resilienceService;
    }

    public void PerformAction()
    {
        // Use resilience service for retry logic
        _resilienceService.ExecuteWithRetry(() => 
        {
            // Send message using message service
            _messageService.SendMessage("My message");
        });
    }
}

Development and Contribution

Prerequisites

Before building the library locally, make sure you have the following installed:

  • .NET SDK: Required to build the library. Download from here.

Step 1: Clone the Repository

Clone the repository to your local machine:

git clone <repository-url>
cd <repository-name>

Step 2: Build the Library

To build the library, use the following command:

dotnet build

Step 3: Run Tests

If there are unit tests included, run the tests to ensure everything works as expected:

dotnet test

Step 4: Publish to NuGet

To publish the package to NuGet, use the following command:

dotnet nuget push <package-file> --api-key <api-key> --source https://api.nuget.org/v3/index.json

Replace <package-file> with the .nupkg file and <api-key> with your NuGet API key.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Conclusion

The Common Infrastructure Library provides a set of reusable components that simplify common tasks and patterns in .NET applications. It is designed to be packaged as a NuGet library for easy integration into other projects. With components for messaging, resilience, data access, and request context management, this library helps build robust, maintainable applications.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Common.Infrastructure.Lib:

Package Downloads
Common.Keycloak.Lib

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.1 30 1/19/2026
2.4.0 49 1/19/2026
2.3.21 49 1/16/2026
2.3.20 38 1/16/2026
2.3.19 40 1/15/2026
2.3.18 62 1/14/2026
2.3.17 99 1/13/2026
2.3.16 103 1/12/2026
2.3.15 96 1/12/2026
2.3.14 139 1/7/2026
2.3.13 106 1/6/2026
2.3.12 307 12/23/2025
2.3.11 398 12/19/2025
2.3.10 718 12/10/2025
2.3.9 701 12/10/2025
2.3.8 764 12/8/2025
2.3.7 535 12/5/2025
2.3.6 1,184 12/3/2025
2.3.5 1,042 12/1/2025
2.3.4 667 11/26/2025
2.3.3 602 11/25/2025
2.3.2 626 11/25/2025
2.3.1 609 11/25/2025
2.3.0 787 11/21/2025
2.2.4 753 11/21/2025
2.2.3 921 11/19/2025
2.2.1 904 11/12/2025
2.2.0 1,433 11/11/2025
2.1.17 827 11/6/2025
2.1.16 829 10/29/2025
2.1.15 810 10/29/2025
2.1.14 832 10/14/2025
2.1.13 812 10/14/2025
2.1.12 827 10/13/2025
2.1.11 850 10/13/2025
2.1.10 814 10/12/2025
2.1.9 769 10/11/2025
2.1.8 897 9/28/2025
2.1.7 908 9/26/2025
2.1.6 957 9/12/2025
2.1.5 938 9/12/2025
2.1.4 989 9/10/2025
2.1.3 946 9/10/2025
2.1.2 953 9/10/2025
2.1.1 967 9/9/2025
2.1.0 979 9/4/2025
2.0.106 968 9/3/2025
2.0.105 996 9/1/2025
2.0.104 991 8/29/2025
2.0.103 988 8/29/2025
2.0.102 992 8/29/2025
2.0.101 1,005 8/28/2025
2.0.100 990 8/27/2025
2.0.99 1,015 8/26/2025
2.0.98 1,090 8/25/2025
2.0.97 957 8/20/2025
2.0.96 955 8/20/2025
2.0.95 949 8/19/2025
2.0.94 971 8/13/2025
2.0.93 1,458 8/8/2025
2.0.92 1,319 8/8/2025
2.0.91 1,270 8/7/2025
2.0.90 1,281 8/6/2025
2.0.89 1,256 8/6/2025
2.0.88 1,251 8/5/2025
2.0.87 1,151 8/3/2025
2.0.86 1,112 8/3/2025
2.0.85 1,146 7/31/2025
2.0.84 1,140 7/31/2025
2.0.83 1,157 7/30/2025
2.0.82 1,117 7/29/2025
2.0.81 1,113 7/29/2025
2.0.80 1,182 7/28/2025
2.0.79 1,513 7/23/2025
2.0.78 1,566 7/23/2025
2.0.77 1,561 7/22/2025
2.0.76 1,504 7/21/2025
2.0.75 1,442 7/21/2025
2.0.74 1,098 7/19/2025
2.0.73 1,093 7/19/2025
2.0.72 1,110 7/18/2025
2.0.71 1,196 7/17/2025
2.0.70 1,164 7/17/2025
2.0.69 1,282 7/14/2025
2.0.68 1,572 7/8/2025
2.0.67 1,171 7/8/2025
2.0.66 1,182 7/8/2025
2.0.65 1,160 7/8/2025
2.0.64 1,166 7/8/2025
2.0.63 1,167 7/8/2025
2.0.62 1,169 7/8/2025
2.0.61 1,172 7/8/2025
2.0.60 1,277 7/8/2025
2.0.59 1,153 7/7/2025
2.0.58 1,121 7/4/2025
2.0.57 1,140 7/4/2025
2.0.56 1,157 7/3/2025
2.0.55 1,165 7/2/2025
2.0.54 1,163 7/2/2025
2.0.53 1,169 7/2/2025
2.0.52 1,173 7/1/2025
2.0.51 1,157 6/30/2025
2.0.50 1,154 6/29/2025
2.0.49 1,176 6/29/2025
2.0.48 1,158 6/25/2025
2.0.47 1,184 6/24/2025
2.0.46 1,153 6/24/2025
2.0.45 1,149 6/24/2025
2.0.44 1,167 6/24/2025
2.0.43 1,171 6/24/2025
2.0.42 1,159 6/23/2025
2.0.41 1,160 6/23/2025
2.0.40 1,162 6/23/2025
2.0.39 1,158 6/20/2025
2.0.38 1,170 6/19/2025
2.0.37 1,169 6/19/2025
2.0.36 1,168 6/18/2025
2.0.35 1,305 6/12/2025
2.0.34 1,308 6/12/2025
2.0.33 1,313 6/11/2025
2.0.32 1,327 6/10/2025
2.0.31 1,295 6/10/2025
2.0.30 1,315 6/9/2025
2.0.29 1,470 6/9/2025
2.0.28 1,267 6/9/2025
2.0.27 1,181 6/4/2025
2.0.26 1,199 6/2/2025
2.0.25 1,168 6/2/2025
2.0.24 1,183 6/2/2025
2.0.22 1,171 6/2/2025
2.0.21 1,157 6/2/2025
2.0.20 1,167 6/2/2025
2.0.19 1,196 5/29/2025
2.0.18 1,169 5/29/2025
2.0.17 1,169 5/29/2025
2.0.16 1,163 5/28/2025
2.0.15 1,160 5/28/2025
2.0.14 1,227 5/27/2025
2.0.13 1,176 5/27/2025
2.0.12 1,176 5/27/2025
2.0.11 1,177 5/26/2025
2.0.10 1,178 5/26/2025
2.0.9 1,163 5/22/2025
2.0.4 1,170 5/22/2025
2.0.2 1,173 5/20/2025
2.0.1 1,262 5/14/2025
1.0.102 1,285 5/14/2025
1.0.100 1,130 5/9/2025
1.0.99 1,164 5/8/2025
1.0.98 1,169 5/8/2025
1.0.97 1,203 5/8/2025
1.0.96 1,173 5/8/2025
1.0.95 1,178 5/8/2025
1.0.94 1,192 5/8/2025
1.0.93 1,225 5/7/2025
1.0.92 1,180 5/5/2025
1.0.91 1,155 5/5/2025
1.0.90 1,171 5/5/2025
1.0.89 1,167 5/5/2025
1.0.88 1,175 5/5/2025
1.0.87 1,175 5/5/2025
1.0.86 1,171 5/5/2025
1.0.85 1,168 5/5/2025
1.0.84 1,199 4/29/2025
1.0.83 1,177 4/28/2025
1.0.82 1,196 4/28/2025
1.0.81 1,173 4/28/2025
1.0.80 1,171 4/27/2025
1.0.79 1,137 4/27/2025
1.0.78 1,102 4/26/2025
1.0.77 1,113 4/25/2025
1.0.76 1,108 4/25/2025
1.0.75 1,193 4/25/2025
1.0.74 1,172 4/23/2025
1.0.73 1,189 4/22/2025
1.0.72 1,351 4/15/2025
1.0.71 1,230 4/15/2025
1.0.70 1,258 4/14/2025
1.0.69 1,157 4/11/2025
1.0.68 1,240 4/9/2025
1.0.67 1,223 4/9/2025
1.0.66 1,215 4/7/2025
1.0.65 1,219 4/7/2025
1.0.64 1,193 4/1/2025
1.0.63 1,169 3/27/2025
1.0.62 1,483 3/26/2025
1.0.61 1,520 3/25/2025
1.0.60 1,208 3/18/2025
1.0.59 1,188 3/17/2025
1.0.58 1,210 3/17/2025
1.0.57 1,372 3/16/2025
1.0.56 1,314 3/10/2025
1.0.55 1,333 3/10/2025
1.0.54 1,180 2/27/2025
1.0.53 1,154 2/19/2025
1.0.52 1,214 2/17/2025
1.0.51 1,140 2/17/2025
1.0.50 1,222 2/14/2025
1.0.49 1,158 2/13/2025
1.0.48 1,212 2/13/2025
1.0.47 1,145 2/13/2025
1.0.46 1,146 2/12/2025
1.0.45 1,199 2/3/2025
1.0.44 1,134 2/3/2025
1.0.43 1,238 1/18/2025
1.0.42 1,237 1/15/2025
1.0.41 1,098 1/14/2025
1.0.40 1,114 1/14/2025
1.0.39 1,138 1/2/2025
1.0.38 1,228 12/31/2024
1.0.37 1,280 12/26/2024
1.0.36 1,230 12/22/2024
1.0.35 1,403 12/9/2024
1.0.34 1,377 12/5/2024
1.0.33 1,144 12/5/2024
1.0.32 1,136 12/5/2024
1.0.31 1,302 12/5/2024
1.0.30 1,533 12/2/2024
1.0.29 1,131 12/2/2024
1.0.28 1,125 12/2/2024
1.0.27 1,141 12/2/2024
1.0.26 1,195 12/2/2024
1.0.25 1,147 11/29/2024
1.0.24 1,128 11/29/2024
1.0.23 1,159 11/28/2024
1.0.22 1,137 11/28/2024
1.0.21 1,161 11/27/2024
1.0.20 1,144 11/27/2024
1.0.19 1,184 11/26/2024
1.0.18 1,139 11/25/2024
1.0.17 1,149 11/25/2024
1.0.15 1,124 11/21/2024
1.0.14 1,138 11/21/2024
1.0.13 1,127 11/20/2024
1.0.12 1,176 11/13/2024
1.0.11 1,322 11/13/2024
1.0.10 1,144 11/8/2024
1.0.9 1,152 10/29/2024
1.0.8 1,176 10/29/2024
1.0.7 1,163 10/28/2024
1.0.6 1,200 10/25/2024
1.0.5 1,189 10/25/2024
1.0.4 1,174 10/22/2024
1.0.3 1,125 10/22/2024
1.0.2 1,127 10/22/2024
1.0.1 1,359 10/15/2024
1.0.0 1,178 10/11/2024