百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

Panda.DynamicWebApi

> 编程语言
开源

ASP.NET Core 动态 Restful WebApi。基于类生成 WebApi。例如:基于业务逻辑层直接生成 WebApi。

605 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

ASP.NET Core 动态 Restful WebApi。基于类生成 WebApi。例如:基于业务逻辑层直接生成 WebApi。

Panda.DynamicWebApi

Language: English | 中文

Panda.DynamicWebApi is a component that dynamically generates WebApi. The generated API conforms to the Restful style and is inspired by ABP. It can generate WebApi based on qualified classes. The logic is directly called by the MVC framework. There is no performance problem. It is perfectly compatible with Swagger to build the API documentation. There is no difference compared with manually writing the Controller.

Application Scenario: The application logic layer in the DDD architecture, which can be used to directly generate WebApi without using the Controller. .NET 9.0 support coming soon.

1.Quick Start

(1)Create a new ASP.NET Core WebApi (or MVC) project

(2)Install Package

bash
Install-Package Panda.DynamicWebApi

(3)Create a class named AppleAppService, implement the IDynamicWebApi interface, and add the attribute [DynamicWebApi]

…

`

(4)Register DynamicWebApi in Startup

csharp
public void ConfigureServices(IServiceCollection services)
{
    services.AddDynamicWebApi();
}

(5)Add Swagger

(6)Run

After running the browser, visit /swagger/index.html and you will see the WebApi generated for our AppleAppService.

This quick start Demo Address: link

2.Advanced

(1)There are two conditions that need to be met for a class to generate a dynamic API. One is that the class direct or indirect implements IDynamicWebApi, and the class itself or parent abstract class or Implemented interface has the property DynamicWebApi

(2)Adding the attribute [NonDynamicWebApi] allows a class or a method to not generate an API, and [NonDynamicWebApi] has the highest priority.

(3)The suffix of the dynamic API class name that conforms to the rule is deleted. For example, our quick start AppleAppService will delete the AppService suffix. This rule can be dynamically configured.

(4)The API route prefix is automatically added, and the api prefix is added by default for all APIs.

(5)The default HTTP verb is POST, which can be understood as the Http Method of the API. But it can be overridden by HttpGet/HttpPost/HttpDelete and other ASP.NET Core built-in attribute.

(6)You can override the default route with built-in attribute such as HttpGet/HttpPost/HttpDelete

(7)By default, HTTP verbs are set according to your method name. For example, the API verb generated by CreateApple or Create is POST. The comparison table is as follows. If you hit (ignore uppercase) the comparison table, then this part of the API name will be Omitted, such as CreateApple will become Apple, if not in the following comparison table, will use the default verb POST

MethodName Start With Http Verb
create POST
add POST
post POST
get GET
find GET
fetch GET
query GET
update PUT
put PUT
delete DELETE
remove DELETE

(8)It is highly recommended that the method name use the PascalCase specification and use the verbs from the above table. Such as:

Create Apple Info-> Add/AddApple/Create/CreateApple

Update Apple Info -> Update/UpdateApple

...

(9)The [DynamicWebApi] attribute can be inherited, so it is forbidden to be placed on a parent class other than an abstract class or interface for the parent class to be misidentified.

3.Configuration

All configurations are in the object DynamicWebApiOptions, as explained below:

Property Require 说明
DefaultHttpVerb False Default:POST.
DefaultAreaName False Default:Empty.
DefaultApiPrefix False Default:api. Web API route prefix.
RemoveControllerPostfixes False Default:AppService/ApplicationService. The suffix of the class name that needs to be removed.
RemoveActionPostfixes False Default:Async. Method name needs to be removed from the suffix.
FormBodyBindingIgnoredTypes False Default:IFormFile。Ignore type for MVC Form Binding.

4.Q&A

If you encounter problems, you can use Issues to ask questions.

5.Reference project

This project directly or indirectly refers to the following items

  • ABP

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#asp-net-coredynamic-webapi

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言