WWB.NET.Framework
1.0.0
dotnet add package WWB.NET.Framework --version 1.0.0
NuGet\Install-Package WWB.NET.Framework -Version 1.0.0
<PackageReference Include="WWB.NET.Framework" Version="1.0.0" />
<PackageVersion Include="WWB.NET.Framework" Version="1.0.0" />
<PackageReference Include="WWB.NET.Framework" />
paket add WWB.NET.Framework --version 1.0.0
#r "nuget: WWB.NET.Framework, 1.0.0"
#:package WWB.NET.Framework@1.0.0
#addin nuget:?package=WWB.NET.Framework&version=1.0.0
#tool nuget:?package=WWB.NET.Framework&version=1.0.0
WWB.NET.Framework
WWB.NET.Framework 是一个基于 .NET 10 的可复用 ASP.NET Core 后端基础设施框架,提供缓存与 Redis、SqlSugar 持久化、JWT、雪花 Id、Quartz 调度、统一 Web 能力、领域事件、仓储、工作单元和 AOP 等通用能力。
安装
<PackageReference Include="WWB.NET.Framework" Version="1.0.0" />
最小装配
在宿主项目的 Program.cs 中显式注册框架和业务模块:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddNetModule<DemoModuleMarker>();
builder.Services.AddNetFramework(builder.Configuration);
var app = builder.Build();
app.UseNetFramework();
app.MapControllers();
app.Run();
业务模块应使用程序集 Marker 注册模块程序集;框架不会隐式扫描宿主进程中的所有项目程序集。Controller 是否暴露由模块自己的 AddNet...Controllers() 扩展按需控制。
配置
生产环境请通过配置中心或环境变量提供数据库、Redis、JWT 和跨域配置。不要将连接字符串、签名密钥或其他敏感信息提交到源码仓库。
框架支持 PostgreSQL、MySQL、SQL Server 和 SQLite。数据库初始化、迁移和种子数据应由业务模块的 Infrastructure 层负责。
设计约束
- 业务模块按
Domain、Application、Infrastructure分层。 Domain不依赖 Web 或 Infrastructure 实现细节。- 所有模块程序集由宿主显式注册,支持按需装配。
- 写操作使用
[UnitOfWork]管理事务;分布式锁使用[RedisLock]。 - Redis 不可用时,依赖 Redis 的能力会快速失败并返回明确异常。
文档与示例
仓库地址:https://github.com/wwb/WWB.NET.Framework
示例宿主和 Demo 模块位于 backend/src/WWB.NET.Simple.Host 与 backend/src/WWB.NET.Simple.Demo。
许可证
本项目采用 MIT License,详见包内 LICENSE 文件。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Asp.Versioning.Mvc (>= 10.2.1)
- AspectCore.Core (>= 3.0.0)
- AspectCore.Extensions.DependencyInjection (>= 3.0.0)
- BCrypt.Net-Next (>= 4.2.0)
- FreeRedis (>= 1.5.5)
- Mapster (>= 10.0.11)
- Mapster.DependencyInjection (>= 10.0.11)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.11)
- Microsoft.AspNetCore.OpenApi (>= 10.0.11)
- Microsoft.Data.Sqlite (>= 10.0.11)
- Microsoft.Extensions.DependencyModel (>= 10.0.11)
- Npgsql (>= 10.0.3)
- Quartz (>= 3.19.1)
- Quartz.Extensions.DependencyInjection (>= 3.19.1)
- Quartz.Extensions.Hosting (>= 3.19.1)
- Quartz.Serialization.Json (>= 3.19.1)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Settings.Configuration (>= 10.0.1)
- SnowflakeId.AutoRegister (>= 1.0.4)
- SnowflakeId.AutoRegister.StackExchangeRedis (>= 1.0.3)
- SqlSugarCore (>= 5.1.4.217)
- Yitter.IdGenerator (>= 1.0.14)
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 | 92 | 8/17/2026 |