RiverLi.Blog.Infrastructure.Shared
1.0.3
dotnet add package RiverLi.Blog.Infrastructure.Shared --version 1.0.3
NuGet\Install-Package RiverLi.Blog.Infrastructure.Shared -Version 1.0.3
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.Shared" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RiverLi.Blog.Infrastructure.Shared" Version="1.0.3" />
<PackageReference Include="RiverLi.Blog.Infrastructure.Shared" />
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.Shared --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RiverLi.Blog.Infrastructure.Shared, 1.0.3"
#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.Shared@1.0.3
#: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.Shared&version=1.0.3
#tool nuget:?package=RiverLi.Blog.Infrastructure.Shared&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RiverLi.Blog.Infrastructure.Shared
RiverLi.Blog 微服务集群通用 DDD 基础设施共享库,包含 EFCore 实现、MassTransit 实现和 Redis 实现。
概述
这是一个为 RiverLi.Blog 微服务集群提供通用基础设施组件的共享库。它包含了常见的基础设施功能实现,如数据访问、缓存、事件总线等。
功能特性
- 数据访问: 基于 Entity Framework Core 的仓储模式实现
- 缓存: 基于 Redis 的缓存服务
- 事件总线: 基于 MassTransit 和 RabbitMQ 的事件发布机制
- 认证: JWT 认证相关配置
- 健康检查: 集成 ASP.NET Core 健康检查功能
- 日志记录: 使用 Serilog 进行结构化日志记录
- 弹性策略: 集成 Polly 提供重试和断路器功能
- 分布式追踪: OpenTelemetry 支持
依赖项
- .NET 9.0
- Entity Framework Core
- MassTransit (RabbitMQ)
- StackExchange Redis
- MediatR
- Serilog
- OpenTelemetry
- Health Checks
安装
Install-Package RiverLi.Blog.Infrastructure.Shared
或
dotnet add package RiverLi.Blog.Infrastructure.Shared
NuGet 包打包和发布
前置要求
- .NET 9.0 SDK 或更高版本
- NuGet.org API Key (用于上传到公共源)
- 如果
RiverLi.DDD.Core未作为 NuGet 包发布,需要先处理依赖关系
打包步骤
方式一: 使用自动化脚本(推荐)
# 运行打包脚本
.\publish-nuget.ps1
脚本会自动执行:
- 清理构建产物
- 还原依赖
- 构建项目(Release 模式)
- 生成 NuGet 包
- 可选: 上传到 NuGet.org
方式二: 手动打包
# 1. 清理
dotnet clean --configuration Release
# 2. 还原依赖
dotnet restore
# 3. 构建
dotnet build --configuration Release
# 4. 打包
dotnet pack --configuration Release --output ./nupkg
生成的包位于 ./nupkg 目录中。
上传到 NuGet.org
# 设置 API Key(只需一次)
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
# 上传包
dotnet nuget push ./nupkg/RiverLi.Blog.Infrastructure.Shared.1.0.3.nupkg --api-key YOUR_API_KEY --source nuget.org
或使用环境变量:
# 设置环境变量
$env:NUGET_API_KEY="your-api-key-here"
# 运行脚本并自动上传
.\publish-nuget.ps1
版本号管理
修改 .csproj 文件中的 <Version> 属性:
<PropertyGroup>
<Version>1.0.4</Version>
</PropertyGroup>
遵循 语义化版本 规范:
- 主版本号: 不兼容的 API 修改
- 次版本号: 向下兼容的功能性新增
- 修订号: 向下兼容的问题修正
注意事项
外部依赖: 本项目引用了
RiverLi.DDD.Core,需要确保:- 该依赖已发布为 NuGet 包,或
- 在打包时调整项目结构
符号包: 配置已启用符号包生成(
.snupkg),支持远程调试包验证: 上传前可使用以下命令验证包:
dotnet nuget verify ./nupkg/RiverLi.Blog.Infrastructure.Shared.1.0.3.nupkg
| 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
- Asp.Versioning.Mvc (>= 8.1.1)
- Asp.Versioning.Mvc.ApiExplorer (>= 8.1.1)
- AspNetCore.HealthChecks.MySql (>= 9.0.0)
- AspNetCore.HealthChecks.Rabbitmq (>= 9.0.0)
- AspNetCore.HealthChecks.Redis (>= 9.0.0)
- AspNetCore.HealthChecks.UI.Client (>= 9.0.0)
- Dapper (>= 2.1.66)
- FluentValidation (>= 12.1.1)
- MassTransit.RabbitMQ (>= 9.0.0)
- MediatR (>= 14.0.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 9.0.12)
- Microsoft.AspNetCore.OpenApi (>= 9.0.12)
- Microsoft.EntityFrameworkCore (>= 9.0.12)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.12)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 9.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 9.0.12)
- Microsoft.Extensions.Http.Polly (>= 10.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.2)
- MySql.Data (>= 9.6.0)
- OpenTelemetry (>= 1.15.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.0)
- OpenTelemetry.Extensions.Hosting (>= 1.15.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.0)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.15.0-beta.1)
- OpenTelemetry.Instrumentation.Http (>= 1.15.0)
- Refit.HttpClientFactory (>= 9.0.2)
- RiverLi.DDD.Core (>= 1.0.9)
- Scalar.AspNetCore (>= 2.12.36)
- Serilog.AspNetCore (>= 9.0.0)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Formatting.Compact (>= 3.0.0)
- Serilog.Sinks.Console (>= 6.1.1)
- Serilog.Sinks.File (>= 7.0.0)
- Serilog.Sinks.Seq (>= 9.0.0)
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.3 | 82 | 7/11/2026 |