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

net-dynamic-api

> 编程语言
开源

一款库,可将您的模型转换为完全可用的 API,可将模型定义为 Markdown(即将推出)、JSON 或 C#。

194 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一款库,可将您的模型转换为完全可用的 API,可将模型定义为 Markdown(即将推出)、JSON 或 C#。

Getting Started | Samples | Walkthrough Video

Get fully working CRUD API's in an instant!

Build & Nuget Status

Version Build Nuget
Main 0.7.0
VNext 0.8.0

About

The API Generator is a tool that helps you create fully functioning CRUD microservices with ease. Whether you use C# classes or a JSON definition, the API Generator takes care of all the necessary components, such as routes, database handling, migrations, openapi spec, and OData. All you have to do is write your model, and you'll have a CRUD API complete with filtering, sorting, selectable fields, and all the other features offered by both OData and classic REST.

Creating a CRUD API has never been easier. With just a few lines of code, you can have a working API in no time. Here's a simple example:

csharp
/// 
/// This is as simple as it gets, yes this is a working api ;)
/// 
[Api("/simple")]
public class SimpleSample : IObjectBase
{
  public int Id { get; set; }
  public string Name { get; set; }
  public int Value { get; set; }
}

Or, if you prefer using JSON:

csharp
 [Api("/people", ApiMethodsToGenerate.All )]
 public class Person : Trackable, 
    IObjectBase,
    IBeforeUpdate, // Before Update Hook
    IBeforeDelete, // BeforeDelete Hook
 {
    public string Name { get; set; }
    public DateTime Date { get; set; }
    public string Description { get; set; }
    public int Age { get; set; }
    public Guid Id { get; set; }
 }

And this is also the FULL code for a working API using the JSON mode:

json
[
    {
      "name": "Car",
      "route": "/cars",
      "caching": true,
      "cacheLiveTime": 1000,
      "events": "POST,PUT,DELETE",
      "idType":  "int", 
      "Fields": [
        {
          "name": "Name",
          "type": "String",
          "maxLength": "200",
          "nullable": false
        }
      ]
    }
  ]

Getting Started & Documentation

Read this for a more detailed guide -> https://www.tcdev.de/tcdev-api-generator-getting-started Or just follow these steps:

  • Install the package
csharp
dotnet add package TCDev.ApiGenerator --prerelease

after the package is installed add this to your program.cs (or startup.cs)

csharp
// Add API Generator and load data
builder.Services.AddApiGeneratorServices()
                //From Assembly with OData .AddAssemblyWithOData(Assembly.GetExecutingAssembly())
                //or as JSON from Uri .AddAssemblyWithODataFromUri("https://raw.githubusercontent.com/DeeJayTC/net-dynamic-api/main/sample/SampleAppJson/ApiDefinition.json","")
                //Or without OData .AddAssembly(Assembly.GetExecutingAssembly())
                .AddDataContextSQL() // or Postgres or SQLite
                .AddOData()
                .AddSwagger(true);

Documentation

https://docs.rasepi.com/

Samples

You can find samples for using the library in the samples repository, constantly updated to match latest version and features:

https://github.com/DeeJayTC/api-generator-samples

Issues· 0 开放

查看全部 Issues在 GitHub 打开

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

> 标签

C#asp-net-corecsharpdotnet-coreentity-framework-core

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

> 工具信息

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

> 相关工具

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