net-dynamic-api icon indicating copy to clipboard operation
net-dynamic-api copied to clipboard

Important: Changes to depedencies and structure in next version

Open DeeJayTC opened this issue 2 years ago • 0 comments

The current version was meant as a showcase and test. After quite a bit of feedback we now know that at its core the functionality is great and working. I got various requests to change the solution and dependencies so you only need what you're actually using.

From the next version this will be a breaking change!

Currently, there's only one package which has all the dependencies needed for all options, this is changing in the next version. Functionality will be split into various Nuget packages to allow cherry picking dependencies and functionality.

Core Packages

TCDev.APIGenerator - The core package containing most of the important bits and pieces, this is always required TCDev.APIGenerator.Schema - Schema for all other packages, auto installed as dependency and always required TCDev.APIGenerator.Data - Responsible for all Database functionality and always required when using any Database.

TCDev.APIGenerator.Swagger - Needed if you want to use swagger openapi generation and swagger ui TCDev.APIGenerator.OData - Needed for all of the OData functionality.

Data Packages

TCDev.APIGenerator.Data.SQL - needed when using SQL Server or Azure SQL TCDev.APIGenerator.Data.SQLite - needed when using SQLite TCDev.APIGenerator.Data.Postgres - needed when using Postgres TCDev.APIGenerator.Data.Redis - needed when using redis cache TCDev.APIGenerator.Data.InMemory - needed when using InMemory Database

Changes to the configuration

The initialization code will change from one line to a more fine-grained approach that follows other .NET Core libraries. Here's one example:

builder.Services
                .AddApiGeneratorServices()
                .AddAssembly<T>() // Add the assembly containing your classes
                .AddConfiguration(config key or config object)
                .AddAuthentication(options -> {})
                .AddJsonSource(URL or string) // Add model via JSON (can be a URL or json string)
                .AddDataContextSQL() //or AddDataContextSQLite etc
                .AddOData(options -> {})
                .AddSwagger(options -> {})
                .AddRedis(options -> {});

By changing the initialization code developers can now define functionality a lot more fine-grained and can cherry-pick whether to use swagger, OData, and later on other functionality.

This is planned for the next version, feedback is appreciated!

DeeJayTC avatar May 23 '22 18:05 DeeJayTC