RiverLi.Blog.Infrastructure
1.0.0
dotnet add package RiverLi.Blog.Infrastructure --version 1.0.0
NuGet\Install-Package RiverLi.Blog.Infrastructure -Version 1.0.0
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="RiverLi.Blog.Infrastructure" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RiverLi.Blog.Infrastructure" Version="1.0.0" />
<PackageReference Include="RiverLi.Blog.Infrastructure" />
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 RiverLi.Blog.Infrastructure --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RiverLi.Blog.Infrastructure, 1.0.0"
#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 RiverLi.Blog.Infrastructure@1.0.0
#: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=RiverLi.Blog.Infrastructure&version=1.0.0
#tool nuget:?package=RiverLi.Blog.Infrastructure&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RiverLi.Blog.Infrastructure 🔧
简介 基础设施库,提供微服务常用的实现:
- Redis 缓存适配(
RedisCacheService⇒ICacheService) - EF Core 通用仓储(
EfRepository) - 事件总线集成(MassTransit + RabbitMQ,
MassTransitEventPublisher) - 简单的扩展方法:
AddRiverRedisCache,AddRiverEventBus
示例:注册缓存与事件总线
// Startup / Program
builder.Services.AddRiverRedisCache(Configuration);
builder.Services.AddRiverEventBus(Configuration, cfg => {
cfg.AddConsumer<PostCreatedConsumer>();
});
配置项示例 (appsettings.json)
"Redis": { "ConnectionString": "localhost:6379" },
"RabbitMq": { "Host": "localhost", "VirtualHost": "/", "Username": "guest", "Password": "guest" }
发布领域事件(示例)
// 在领域/服务中注入 IDomainEventPublisher
await _publisher.PublishAsync(new PostCreatedEvent { PostId = post.Id, Title = post.Title });
目的 集中化基础能力实现,减少服务间重复代码,简化快速搭建微服务时的基础设施配置。
使用示例
注册 Redis 缓存与事件总线:
builder.Services.AddRiverRedisCache(Configuration);
builder.Services.AddRiverEventBus(Configuration, cfg => { /* 注册消费者 */ });
配置示例
"Redis": { "ConnectionString": "localhost:6379" },
"RabbitMq": { "Host": "localhost", "VirtualHost": "/", "Username": "guest", "Password": "guest" }
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- MassTransit.RabbitMQ (>= 9.0.0)
- MediatR (>= 14.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.12)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.12)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 9.0.12)
- Microsoft.Extensions.Http.Polly (>= 10.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.2)
- Refit.HttpClientFactory (>= 9.0.2)
- RiverLi.DDD.Core (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 145 | 2/2/2026 |