/AutoEndpoints

AutoEndpoints is a WebAPI framework for automatic endpoint building for database entities

Primary LanguageC#MIT LicenseMIT

Overview

AutoEndpoints is a WebAPI framework for automatic endpoint building for database entities

.github/workflows/build.yml

AutoEndpoints.Redis
AutoEndpoints.Cosmos
AutoEndpoints.Dapper.SqlServer

Supported databases:

  1. Redis
  2. Microsoft Azure Cosmos DB
  3. Microsoft SQL Server

Supported platforms:

  • .NET 8+

Example

Program.cs:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRedisEndpoints("localhost:6379");

var app = builder.Build();

app.MapRedisGetEndpoint<RedisTestModel>("{id}")
    .KeyFromRoute("id")
    .Build();

app.MapRedisPostEndpoint<RedisTestModel>("{id}")
    .KeyFromRoute("id")
    .Build();

await app.RunAsync();

Nuget packages links

How to use

Basic steps:

  1. Create new web api project
  2. Added nuget package for target database
Database Nuget package
Redis AutoEndpoints.Redis
Microsoft Azure Cosmos DB AutoEndpoints.Cosmos
Microsoft SQL Server with Dapper AutoEndpoints.Dapper.SqlServer
  1. Register database provider in services
builder.Services.AddRedisEndpoints("localhost:6379");
  1. Map endpoints
app.MapRedisGetEndpoint<RedisTestModel>("{id}")
    .KeyFromRoute("id")
    .Build();

Done