Biwen.QuickApi
2.0.5
dotnet add package Biwen.QuickApi --version 2.0.5
NuGet\Install-Package Biwen.QuickApi -Version 2.0.5
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="Biwen.QuickApi" Version="2.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Biwen.QuickApi" Version="2.0.5" />
<PackageReference Include="Biwen.QuickApi" />
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 Biwen.QuickApi --version 2.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Biwen.QuickApi, 2.0.5"
#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.
#addin nuget:?package=Biwen.QuickApi&version=2.0.5
#tool nuget:?package=Biwen.QuickApi&version=2.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Biwen.QuickApi
项目介绍
临时文档地址 <br/>
Biwen.QuickApi 2+,是一个微型aspnetcore
开发框架,提供minimalapi的QuickApi封装,提供IQuickEndpoint
书写minimalapi,
模块化支持Modular
,多租户
,发布订阅:IEvent
,作业调度:IScheduleTask
,审计:Auditing
,缓存,LocalLock,OpenApi
~~
实际应用与示例项目
提供MySurvey问卷调查示例项目
点击访问示例项目:MySurvey - 一个基于 Biwen.QuickApi 构建的完整问卷调查系统,展示了框架在实际业务场景中的应用。
提供 Headless CMS模块组件
Biwen.QuickApi.Contents - 一个强大的无头CMS扩展,提供以下功能:
- 灵活的内容模型定义系统
- 多种字段类型支持(文本、Markdown、数字、日期、图片等)
- 内容版本控制和审计跟踪
- 内容渲染服务与自定义视图模板
- 通过Slug友好URL访问内容
- 完整的内容API(创建、查询、更新、删除、预览)
- 内容状态工作流(草稿、发布、归档)
- 基于
Elasticsearch
的全文搜索支持
代码示例
基础QuickApi示例
public class MyStore
{
public static Todo[] SampleTodos()
{
return [new(1, "Walk the dog"), new(2, "Buy groceries")];
}
}
[QuickApi("todos")] // 映射到 /api/todos
public class TodoApi : BaseQuickApi<EmptyRequest,Todo[]>
{
public override async ValueTask<Todo[]> ExecuteAsync(EmptyRequest request)
{
await Task.CompletedTask;
return MyStore.SampleTodos();
}
}
带参数的API示例
public class CreateTodoRequest : BaseRequest<CreateTodoRequest>
{
[Required]
public string Title { get; set; } = null!;
public bool IsCompleted { get; set; }
}
[QuickApi("todos", Verbs = Verb.POST)]
[OpenApiMetadata("创建待办事项", "添加一个新的待办事项到系统")]
public class CreateTodoApi : BaseQuickApi<CreateTodoRequest, Todo>
{
private readonly ITodoService _todoService;
public CreateTodoApi(ITodoService todoService)
{
_todoService = todoService;
}
public override async ValueTask<Todo> ExecuteAsync(CreateTodoRequest request, CancellationToken cancellationToken)
{
return await _todoService.CreateAsync(request.Title, request.IsCompleted);
}
}
使用事件系统示例
// 定义事件
public record TodoCreatedEvent(Todo Todo) : IEvent;
// 发布事件
[QuickApi("todos", Verbs = Verb.POST)]
public class CreateTodoApi : BaseQuickApi<CreateTodoRequest, Todo>
{
private readonly ITodoService _todoService;
private readonly IPublisher _publisher;
public CreateTodoApi(ITodoService todoService, IPublisher publisher)
{
_todoService = todoService;
_publisher = publisher;
}
public override async ValueTask<Todo> ExecuteAsync(CreateTodoRequest request)
{
var todo = await _todoService.CreateAsync(request.Title, request.IsCompleted);
// 发布事件
await _publisher.PublishAsync(new TodoCreatedEvent(todo));
return todo;
}
}
// 处理事件
[EventHandler]
public class TodoCreatedEventHandler : IEventHandler<TodoCreatedEvent>
{
private readonly ILogger<TodoCreatedEventHandler> _logger;
public TodoCreatedEventHandler(ILogger<TodoCreatedEventHandler> logger)
{
_logger = logger;
}
public Task HandleAsync(TodoCreatedEvent @event)
{
_logger.LogInformation("新的待办事项已创建: {Title}", @event.Todo.Title);
return Task.CompletedTask;
}
}
设计理念与特点
- REPR设计模式:Biwen.QuickApi遵循 REPR 设计(Request-Endpoint-Response),使API开发结构清晰
- 开箱即用:内置常用功能,无需额外配置即可使用
- 模块化架构:通过模块化设计,实现功能的即插即用和业务的清晰分离
- 强大的扩展性:通过扩展接口,可以轻松定制和扩展框架功能
- 约定优于配置:减少配置代码,提高开发效率
- 完整的文档支持:下载项目源代码运行
Biwen.QuickApi.DocSite
项目获取详细文档
社区与支持
- 欢迎小伙伴们star&issue共同学习进步 Biwen.QuickApi
- 关注作者博客: 作者博客
开发工具
依赖环境&库
- Microsoft.AspNetCore.App
- FluentValidation.DependencyInjectionExtensions
- Microsoft.AspNetCore.OpenApi
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
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- HtmlSanitizer (>= 8.2.871-beta && < 9.0.0)
- Mapster.DependencyInjection (>= 1.0.3-pre02)
- Microsoft.AspNetCore.AsyncState (>= 9.5.0)
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (>= 8.0.16)
- Microsoft.EntityFrameworkCore (>= 8.0.16 && < 9.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.16 && < 9.0.0)
- NCrontab (>= 3.3.3)
- System.Text.Json (>= 9.0.5)
-
net9.0
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- HtmlSanitizer (>= 8.2.871-beta && < 9.0.0)
- Mapster.DependencyInjection (>= 1.0.3-pre02)
- Microsoft.AspNetCore.AsyncState (>= 9.5.0)
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (>= 9.0.5)
- Microsoft.AspNetCore.OpenApi (>= 9.0.5 && < 10.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.5 && < 10.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.5 && < 10.0.0)
- NCrontab (>= 3.3.3)
- System.Text.Json (>= 9.0.5)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Biwen.QuickApi:
Package | Downloads |
---|---|
Biwen.QuickApi.FeatureManagement
Package Description |
|
Biwen.QuickApi.Contents
Package Description |
|
Biwen.QuickApi.MiniProfiler
Biwen.QuickApi ,NET9+ MinimalApi CQRS |
|
Biwen.QuickApi.Storage.AliyunOss
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.5 | 215 | 5/14/2025 |
2.0.3 | 166 | 3/31/2025 |
2.0.2 | 132 | 2/18/2025 |
2.0.1 | 104 | 1/16/2025 |
2.0.0 | 146 | 11/13/2024 |
2.0.0-rc3 | 67 | 10/24/2024 |
2.0.0-rc2 | 71 | 9/26/2024 |
2.0.0-rc1 | 64 | 9/24/2024 |
1.6.3 | 117 | 8/29/2024 |
1.6.2 | 125 | 6/14/2024 |
1.6.1 | 124 | 5/22/2024 |
1.5.2.1 | 113 | 5/16/2024 |
1.5.2 | 131 | 5/15/2024 |
1.5.0 | 111 | 5/13/2024 |
1.4.3.2 | 118 | 5/10/2024 |
1.4.2.2 | 123 | 5/9/2024 |
1.4.2.1 | 125 | 4/10/2024 |
1.4.2 | 148 | 2/21/2024 |
1.4.1 | 239 | 12/8/2023 |
1.4.0 | 145 | 11/15/2023 |
1.3.8 | 140 | 11/9/2023 |
1.3.7.3 | 136 | 11/5/2023 |
1.3.7.2 | 151 | 11/2/2023 |
1.3.7.1 | 152 | 10/21/2023 |
1.3.7 | 146 | 10/19/2023 |
1.3.6 | 171 | 10/15/2023 |
1.3.5 | 144 | 10/12/2023 |
1.0.0 | 144 | 9/21/2023 |