百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

FluentMediator

> DevOps
开源

:twisted_rightwards_arrows: FluentMediator 是一款不干扰的库,允许开发者为命令、查询和事件构建自定义流程。

196 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

:twisted_rightwards_arrows: FluentMediator 是一款不干扰的库,允许开发者为命令、查询和事件构建自定义流程。

FluentMediator

:twisted_rightwards_arrows: We will not require you to add dependencies into your domain or to implement frameworks interfaces in your event handlers. Finally a really loosely coupled mediator library was born.

Install

Install-Package FluentMediator

For seameless .NET Core integration:

Install-Package FluentMediator.Microsoft.Extensions.DependencyInjection

How

Setup your events and pipelines using depedency injection. You can be very creative here! It supports async methods and cancellable tokens parameters, you could append multiple steps select one to return a message. An example:

csharp
services.AddFluentMediator(builder => {
    builder.On().Pipeline()
        .Call((handler, request) => handler.MyMethod(request))
        .Call((handler, request) => handler.MyLongMethod(request))
        .Return(
            (handler, request) => handler.MyOtherMethod(request)
        );
});

Then you are able to use the injected IMediator interface.

Publishing Events

csharp
// Puts the message in the pipeline, calls three handlers.
mediator.Publish(ping);

Sending Commands and Queries

csharp
// Calls the three handlers then get the response from `MyOtherMethod(PingRequest)`.
PingResponse response = mediator.Send(new PingRequest("Ping"));
Console.WriteLine(response.Message); // Prints "Pong"

Why

When designing CQRS or Event-Driven applications we need to publish events from the infrastructure layer into the domain event handlers. We do not want framework dependencies leaking out to the Model then FluentMediator was born.

Contributors

Ivan Paulovich ⚠️

Joakim Carselind

Vaggelis Mparmpas ⚠️

Please contribute with Issues, Wiki and Samples.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#chain-methodschain-of-responsibilitycraftmanshipcsharp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理