Xunet.MiniApi
1.0.36
dotnet add package Xunet.MiniApi --version 1.0.36
NuGet\Install-Package Xunet.MiniApi -Version 1.0.36
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="Xunet.MiniApi" Version="1.0.36" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xunet.MiniApi" Version="1.0.36" />
<PackageReference Include="Xunet.MiniApi" />
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 Xunet.MiniApi --version 1.0.36
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Xunet.MiniApi, 1.0.36"
#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 Xunet.MiniApi@1.0.36
#: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=Xunet.MiniApi&version=1.0.36
#tool nuget:?package=Xunet.MiniApi&version=1.0.36
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Xunet.MiniApi
面向微服务的.NET 最小API支持,功能特性包括:
- 自定义请求处理中间件,统一的数据格式返回,全局异常处理
- 自定义参数签名中间件/过滤器,支持参数签名
- 基于System.Text.Json的序列化和反序列化
- 基于OpenIddict实现客户端管理功能
- 内置健康检查、Swagger接口说明文档
- 内置SqlSugar ORM框架,支持Sqlite、MySql、SqlServer等主流数据库
- 内置FluentValidation框架,支持参数验证,支持自定义验证器
- 内置Redis缓存、MemoryCache缓存,支持分布式缓存
- 支持Jwt认证、自定义授权策略、跨域策略
- 支持限流、事件、授权、映射器等扩展功能
- 支持阿里云对象存储、阿里云短信服务
- 支持腾讯云对象存储、腾讯云短信服务
- 支持微信公众号开发,内置微信公众号/小程序相关接口
Support .NET 8.0+
安装
Xunet.MiniApi 以 NuGet 包的形式提供。您可以使用 NuGet 包控制台窗口安装它:
PM> Install-Package Xunet.MiniApi
使用
Program.cs
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddXunetCache();
builder.Services.AddXunetJsonOptions();
builder.Services.AddXunetFluentValidation();
builder.Services.AddXunetHttpContextAccessor();
builder.Services.AddXunetHealthChecks();
builder.Services.AddXunetSwagger();
builder.Services.AddXunetSqliteStorage();
builder.Services.AddXunetJwtBearer();
builder.Services.AddXunetCors();
builder.Services.AddXunetRateLimiter();
builder.Services.AddXunetEventHandler();
builder.Services.AddXunetAuthorizationHandler();
builder.Services.AddXunetMapper();
builder.Services.AddXunetMiniService();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseXunetRequestHandler();
app.UseXunetHttpContextAccessor();
app.UseXunetHealthChecks();
app.UseXunetSwagger();
app.UseXunetStorage();
app.UseXunetCors();
app.UseRateLimiter();
app.UseAuthentication();
app.UseAuthorization();
// Map endpoints.
app.MapHelloEndpoint();
app.Run();
AppDbContext.cs
public class AppDbContext : SugarDbContext<AppDbContext>
{
}
IHelloService.cs
internal interface IHelloService
{
Task<IResult> SayHelloAsync();
}
HelloService.cs
internal class HelloService : MiniService<AppDbContext>, IHelloService
{
public Task<IResult> SayHelloAsync()
{
return XunetResults.Ok("Hello,world!");
}
}
HelloEndpoint.cs
internal static class HelloEndpoint
{
internal static void MapHelloEndpoint(this WebApplication app)
{
app.MapGet("/api/hello", (IHelloService helloService)
=> helloService.SayHelloAsync());
return app;
}
}
更新日志
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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.
-
net8.0
- AlibabaCloud.SDK.Dysmsapi20170525 (>= 4.0.0)
- Aliyun.OSS.SDK.NetCore (>= 2.14.1)
- AutoMapper (>= 14.0.0)
- Caching.CSRedis (>= 3.8.800)
- FluentScheduler (>= 5.5.1)
- FluentValidation (>= 12.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.8)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.AspNetCore.OpenApi (>= 8.0.8)
- OpenIddict.AspNetCore (>= 6.4.0)
- OpenIddict.EntityFrameworkCore (>= 6.4.0)
- Pomelo.EntityFrameworkCore.MySql (>= 8.0.2)
- RabbitMQ.Client (>= 7.1.2)
- SkiaSharp (>= 3.119.0)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.0)
- SqlSugarCore (>= 5.1.4.198)
- Swashbuckle.AspNetCore (>= 9.0.1)
- Tencent.QCloud.Cos.Sdk (>= 5.4.48)
- TencentCloudSDK (>= 3.0.1278)
-
net9.0
- AlibabaCloud.SDK.Dysmsapi20170525 (>= 4.0.0)
- Aliyun.OSS.SDK.NetCore (>= 2.14.1)
- AutoMapper (>= 14.0.0)
- Caching.CSRedis (>= 3.8.800)
- FluentScheduler (>= 5.5.1)
- FluentValidation (>= 12.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 9.0.6)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.AspNetCore.OpenApi (>= 9.0.6)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.7)
- OpenIddict.AspNetCore (>= 6.4.0)
- OpenIddict.EntityFrameworkCore (>= 6.4.0)
- RabbitMQ.Client (>= 7.1.2)
- SkiaSharp (>= 3.119.0)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.0)
- SqlSugarCore (>= 5.1.4.198)
- Swashbuckle.AspNetCore (>= 9.0.1)
- Tencent.QCloud.Cos.Sdk (>= 5.4.48)
- TencentCloudSDK (>= 3.0.1278)
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.36 | 77 | 7/31/2025 |
1.0.35 | 98 | 7/28/2025 |
1.0.34 | 79 | 7/28/2025 |
1.0.33 | 82 | 7/27/2025 |
1.0.32 | 305 | 7/25/2025 |
1.0.31 | 310 | 7/25/2025 |
1.0.30 | 438 | 7/24/2025 |
1.0.29 | 182 | 7/20/2025 |
1.0.28 | 182 | 7/19/2025 |
1.0.27 | 142 | 7/14/2025 |
1.0.26 | 135 | 7/13/2025 |
1.0.25 | 94 | 7/12/2025 |
1.0.24 | 78 | 7/11/2025 |
1.0.23 | 127 | 7/11/2025 |
1.0.22 | 127 | 7/10/2025 |
1.0.21 | 120 | 7/10/2025 |
1.0.20 | 67 | 7/5/2025 |
1.0.19 | 66 | 7/5/2025 |
1.0.18 | 167 | 6/26/2025 |