![]() |
VOOZH | about |
dotnet add package Common.Infrastructure.Lib --version 3.1.0
NuGet\Install-Package Common.Infrastructure.Lib -Version 3.1.0
<PackageReference Include="Common.Infrastructure.Lib" Version="3.1.0" />
<PackageVersion Include="Common.Infrastructure.Lib" Version="3.1.0" />Directory.Packages.props
<PackageReference Include="Common.Infrastructure.Lib" />Project file
paket add Common.Infrastructure.Lib --version 3.1.0
#r "nuget: Common.Infrastructure.Lib, 3.1.0"
#:package Common.Infrastructure.Lib@3.1.0
#addin nuget:?package=Common.Infrastructure.Lib&version=3.1.0Install as a Cake Addin
#tool nuget:?package=Common.Infrastructure.Lib&version=3.1.0Install as a Cake Tool
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.
The Infrastructure module contains essential components and utilities that provide foundational services required by other parts of the application.
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.
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.
The RequestContext module is responsible for managing request-specific data, ensuring that relevant context is passed throughout the lifecycle of a request.
The Resilience module adds reliability features to the application, including retry policies and circuit breaker patterns, which are critical for fault-tolerant applications.
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.
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.
Once the library is added to your project, you can use the provided classes and utilities:
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");
});
}
}
Before building the library locally, make sure you have the following installed:
Clone the repository to your local machine:
git clone <repository-url>
cd <repository-name>
To build the library, use the following command:
dotnet build
If there are unit tests included, run the tests to ensure everything works as expected:
dotnet test
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.
This project is licensed under the MIT License - see the file for details.
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Common.Infrastructure.Lib:
| Package | Downloads |
|---|---|
|
AsaService.Shared.Lib
Package Description |
This package is not used by any popular GitHub repositories.