![]() |
VOOZH | about |
dotnet add package TCDev.APIGenerator --version 0.7.0
NuGet\Install-Package TCDev.APIGenerator -Version 0.7.0
<PackageReference Include="TCDev.APIGenerator" Version="0.7.0" />
<PackageVersion Include="TCDev.APIGenerator" Version="0.7.0" />Directory.Packages.props
<PackageReference Include="TCDev.APIGenerator" />Project file
paket add TCDev.APIGenerator --version 0.7.0
#r "nuget: TCDev.APIGenerator, 0.7.0"
#:package TCDev.APIGenerator@0.7.0
#addin nuget:?package=TCDev.APIGenerator&version=0.7.0Install as a Cake Addin
#tool nuget:?package=TCDev.APIGenerator&version=0.7.0Install as a Cake Tool
👁 image
Getting Started | Samples | Walkthrough Video
<a href="https://docs.rasepi.com"><img src="https://img.shields.io/badge/Docs-0.6.0-orange"></a> <a href="https://twitter.com/intent/follow?screen_name=timcadenbach"><img src="https://img.shields.io/badge/Twitter-follow-blue"></a> <a href="https://www.github.com/sponsors/deejaytc"><img src="https://img.shields.io/github/sponsors/deejaytc?label=Lovely%20Sponsors" /> </a>
| Version | Build | Nuget | |
|---|---|---|---|
| Main | <img src="https://img.shields.io/github/workflow/status/DeeJayTC/net-dynamic-api/.NET/main?label=Main"> | 0.6.0 | 👁 Build Status Installer pipeline |
| VNext | <img src="https://img.shields.io/github/workflow/status/DeeJayTC/net-dynamic-api/.NET/vnext?label=vnext"> | 0.6.1-RC1 |
The API Generator automatically generates a fully working CRUD Microservice from just your Model (C# Classes) or a JSON Definition. Everything from routes, database handling, migrations, openapi spec, OData etc is working magically out of the box! You just write your model and get a fully working CRUD api with filtering, sorting, selectable fields and everything else OData and classic REST offers.
By using the API Generator, this little code snippet is already a working CRUD API
/// <summary>
/// This is the minimal sample, yes this is a working api ;)
/// </summary>
[Api("/minimal")]
public class MinimalSample : IObjectBase<int>
{
public int Id { get; set; }
public string Name { get; set; }
public int Value { get; set; }
}
Heres another sample:
[Api("/people", ApiMethodsToGenerate.All )]
public class Person : Trackable,
IObjectBase<Guid>,
IBeforeUpdate<Person>, // Before Update Hook
IBeforeDelete<Person>, // 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:
[
{
"name": "Car",
"route": "/cars",
"caching": true,
"cacheLiveTime": 1000,
"events": "POST,PUT,DELETE",
"idType": "int",
"Fields": [
{
"name": "Name",
"type": "String",
"maxLength": "200",
"nullable": false
}
]
}
]
Read this for a more detailed guide → https://www.tcdev.de/tcdev-api-generator-getting-started Or just follow these steps:
dotnet add package TCDev.ApiGenerator --prerelease
after the package is installed add this to your program.cs (or startup.cs)
// 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);
You can find samples for using the library in the samples repository, constantly updated to match latest version and features:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on TCDev.APIGenerator:
| Package | Downloads |
|---|---|
|
TCDev.APIGenerator.OData
Adds OData Support to the API Generator |
|
|
TCDev.APIGenerator.Data.SQL
Adds necessary functionality to use MS SQL Server and Azure SQL Instances with the API Generator. |
|
|
TCDev.APIGenerator.Data.SQLite
Adds necessary functionality to use SQLLite with the API Generator. Rasepi greates fully working CRUD Apis from just models |
|
|
TCDev.APIGenerator.Data.Postgres
Adds necessary functionality to use Postgres databases with the API Generator. Rasepi greates fully working CRUD Apis from just models |
|
|
TCDev.APIGenerator.RabbitMQ
Package adds RabbitMQ events to the APIs. Creates fully working CRUD Apis from just models |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.1-RC1 | 836 | 10/16/2022 |
| 0.7.0 | 1,629 | 11/8/2022 |
| 0.7.0-RC1 | 874 | 7/25/2022 |
| 0.6.0 | 1,671 | 6/24/2022 |
| 0.6.0-RC2 | 983 | 6/24/2022 |
| 0.6.0-RC1 | 792 | 6/24/2022 |
| 0.5.0-WeAreDevs | 731 | 6/12/2022 |
| 0.5.0-WDWC-DEMO-ODATA | 780 | 6/12/2022 |
| 0.5.0-WDWC-DEMO | 829 | 6/11/2022 |
| 0.5.0-WDWC | 824 | 6/11/2022 |
| 0.5.0-alpha-1 | 869 | 6/10/2022 |
| 0.1.5 | 1,050 | 5/6/2022 |
| 0.1.4 | 996 | 4/16/2022 |
| 0.1.3 | 997 | 4/16/2022 |
| 0.1.2 | 1,002 | 4/15/2022 |
| 0.1.2-alpha-6ffff | 741 | 4/16/2022 |
| 0.1.2-alpha-4a262d | 697 | 4/16/2022 |
| 0.1.1-alpha | 706 | 3/29/2022 |
| 0.1.0-alpha-4a262d | 706 | 4/8/2022 |
| 0.1.0-alpha-3f152c | 739 | 4/7/2022 |