Russkyc.MinimalApi.Framework
1.0.0
Prefix Reserved
dotnet add package Russkyc.MinimalApi.Framework --version 1.0.0
NuGet\Install-Package Russkyc.MinimalApi.Framework -Version 1.0.0
<PackageReference Include="Russkyc.MinimalApi.Framework" Version="1.0.0" />
<PackageVersion Include="Russkyc.MinimalApi.Framework" Version="1.0.0" />
<PackageReference Include="Russkyc.MinimalApi.Framework" />
paket add Russkyc.MinimalApi.Framework --version 1.0.0
#r "nuget: Russkyc.MinimalApi.Framework, 1.0.0"
#:package Russkyc.MinimalApi.Framework@1.0.0
#addin nuget:?package=Russkyc.MinimalApi.Framework&version=1.0.0
#tool nuget:?package=Russkyc.MinimalApi.Framework&version=1.0.0
✨ What's New (v1.0.0):
- Scalar API Docs integration
- Shorter setup code for new projects learn more...
- Support for permission control in endpoints learn more...
🎉 Getting Started
Installation
To install the Russkyc.MinimalApi.Framework
package, you can use the NuGet Package Manager or the .NET CLI.
Follow these steps to set up the Russkyc.MinimalApi.Framework
in your project.
- Create a new ASP.NET Core Web API project if you don't already have one.
- Install the
Russkyc.MinimalApi.Framework
NuGet package using the cli or the nuget package manager - Install an EntityFramework Provider like
Microsoft.EntityFrameworkCore.InMemory
orMicrosoft.EntityFrameworkCore.Sqlite
depending on your database choice. - Add the required services, configuration, and mappings in the
Program.cs
file:
There are two options for setting up the framework in your project, a minimal setup and a more granular standard setup.
Minimal Setup
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
using Russkyc.MinimalApi.Framework;
using Russkyc.MinimalApi.Framework.Core;
using Russkyc.MinimalApi.Framework.Core.Access;
using Russkyc.MinimalApi.Framework.Core.Attributes;
await MinimalApiFramework
.CreateDefault(options => options.UseSqlite("Data Source=test.sqlite"))
.RunAsync();
// Define your entity classes here or in a separate file
See the Minimal Sample Project for the complete code.
Standard Setup
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
using Russkyc.MinimalApi.Framework.Core;
using Russkyc.MinimalApi.Framework.Core.Access;
using Russkyc.MinimalApi.Framework.Core.Attributes;
using Russkyc.MinimalApi.Framework.Extensions;
using Russkyc.MinimalApi.Framework.Options;
var builder = WebApplication.CreateBuilder();
// Configure
FrameworkOptions.MapIndexToApiDocs = true;
FrameworkDbContextOptions.DbContextConfiguration = options => options.UseSqlite("Data Source=test.sqlite");
// Add required services
builder.Services
.AddMinimalApiFramework();
var webApplication = builder.Build();
// Add required endpoints
// Optionally, you can disable entity endpoints mapping and map them manually
webApplication.UseMinimalApiFramework(mapEntityEndpoints: false);
// If mapping is disabled, you can manually map entity endpoints
// Manual entity endpoints mapping for more granular control
webApplication.MapEntityEndpoints<SampleEntity, Guid>(options =>
{
// Other endpoint options can be configured here
});
// Sample prefixed mapping
// Same effect can be achieved when using the minimal setup
// by using the `FrameworkOptions` and setting `ApiPrefix`
var apiGroup = webApplication.MapGroup("nested");
apiGroup.MapEntityEndpoints<SampleEmbeddedEntity, int>();
await webApplication.RunAsync();
// Define your entity classes here or in a separate file
See the Standard Sample Project for the complete code.
Full Documentation
For full documentation, please visit MinimalApi Framework - Github
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.OpenApi (>= 8.0.16)
- Microsoft.EntityFrameworkCore (>= 8.0.16)
- Microsoft.EntityFrameworkCore.InMemory (>= 8.0.16)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.16)
- MiniValidation (>= 0.9.2)
- Russkyc.MinimalApi.Framework.Core (>= 1.0.0)
- scalar.aspnetcore (>= 2.4.22)
- Scalar.AspNetCore.Swashbuckle (>= 2.4.22)
- System.Linq.Dynamic.Core (>= 1.6.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Whats New:
- Scalar Integartion
- Shorter setup code
- Permissions based access control
Note: This update contains breaking changes.