TCDev.APIGenerator.OData 0.7.1-RC1

This is a prerelease version of TCDev.APIGenerator.OData.
dotnet add package TCDev.APIGenerator.OData --version 0.7.1-RC1                
NuGet\Install-Package TCDev.APIGenerator.OData -Version 0.7.1-RC1                
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="TCDev.APIGenerator.OData" Version="0.7.1-RC1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TCDev.APIGenerator.OData --version 0.7.1-RC1                
#r "nuget: TCDev.APIGenerator.OData, 0.7.1-RC1"                
#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.
// Install TCDev.APIGenerator.OData as a Cake Addin
#addin nuget:?package=TCDev.APIGenerator.OData&version=0.7.1-RC1&prerelease

// Install TCDev.APIGenerator.OData as a Cake Tool
#tool nuget:?package=TCDev.APIGenerator.OData&version=0.7.1-RC1&prerelease                

image Getting Started | Samples | Walkthrough Video

Get fully working CRUD API's in an instant!

<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>

Build & Nuget Status

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

About

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
        }
      ]
    }
  ]

Getting Started & Docoumentation

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

  • Install the package
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);

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

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on TCDev.APIGenerator.OData:

Repository Stars
DeeJayTC/net-dynamic-api
A library that turns your model into a fully working API, define your model as markdown (soon), json or c#.
Version Downloads Last updated
0.7.1-RC1 176 10/16/2022
0.7.0 350 11/8/2022
0.7.0-RC1 167 7/25/2022
0.6.0 465 6/24/2022
0.6.0-RC2 262 6/24/2022
0.6.0-RC1 162 6/24/2022