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" />
                    
Directory.Packages.props
<PackageReference Include="RiverLi.Blog.Infrastructure" />
                    
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 RiverLi.Blog.Infrastructure --version 1.0.0
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=RiverLi.Blog.Infrastructure&version=1.0.0
                    
Install as a Cake Tool

RiverLi.Blog.Infrastructure 🔧

build

简介 基础设施库,提供微服务常用的实现:

  • Redis 缓存适配(RedisCacheServiceICacheService
  • 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 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.

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