Interlink 1.0.1
See the version list below for details.
dotnet add package Interlink --version 1.0.1
NuGet\Install-Package Interlink -Version 1.0.1
<PackageReference Include="Interlink" Version="1.0.1" />
<PackageVersion Include="Interlink" Version="1.0.1" />
<PackageReference Include="Interlink" />
paket add Interlink --version 1.0.1
#r "nuget: Interlink, 1.0.1"
#:package Interlink@1.0.1
#addin nuget:?package=Interlink&version=1.0.1
#tool nuget:?package=Interlink&version=1.0.1
Interlink
Interlink is a lightweight and modern mediator library for .NET, designed to decouple your code through request/response and notification patterns. Built with simplicity and performance in mind, it helps streamline communication between components while maintaining a clean architecture.
✨ Features
- 🧩 Simple mediator pattern for request/response
- 🔄 Decouples logic using handlers
- 🧩 Easy registration with
AddInterlink()
- 🔧 Supports dependency injection with
IServiceProvider
- 🚀 Lightweight, fast, and no external dependencies
- ✅ Fully compatible with .NET 8, .NET 9
💡 Why Interlink?
- Clean, intuitive API
- No bloat, just mediation
- Ideal for CQRS, Clean Architecture, and modular designs
🛠️ Usage
1. Install Interlink
You can install Interlink via NuGet Package Manager or .NET CLI.
dotnet add package Interlink
1. Register Interlink in your Startup.cs
or Program.cs
using Interlink;
builder.Services.AddInterlink();
2. Define a Request and Response
public class GetAllPets
{
public record Query : IRequest<List<string>>;
public class Handler : IRequestHandler<Query, List<string>>
{
public Task<List<string>> Handle(Query request, CancellationToken cancellationToken)
{
var pets = new List<string> { "Dog", "Cat", "Fish" };
return Task.FromResult(pets);
}
}
}
[ApiController]
[Route("api/[controller]")]
public class PetController(ISender sender) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetAllPets(CancellationToken cancellationToken)
{
var pets = await sender.Send(new GetAllPets.Query(), cancellationToken);
return Ok(pets);
}
}
📦 API Overview
IRequest<TResponse>
Marker interface for requests that return a TResponse.
public interface IRequest<TResponse> { }
IRequestHandler<TRequest, TResponse>
Handles the request and returns a response.
public interface IRequestHandler<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken);
}
ISender
Used to send requests to the appropriate handler.
public interface ISender
{
Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default);
}
⚙️ How it Works
AddInterlink()
scans the provided assembly for all classes that implement IRequestHandler<TRequest, TResponse>
and registers them with the DI container. The Sender
uses IServiceProvider
to resolve and invoke the matching handler.
📜 License
MIT License © ManuHub
Product | Versions 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 is compatible. 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. |
-
net8.0
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.