Fritz.InstantAPIs
0.2.0-preview-1
See the version list below for details.
dotnet add package Fritz.InstantAPIs --version 0.2.0-preview-1
NuGet\Install-Package Fritz.InstantAPIs -Version 0.2.0-preview-1
<PackageReference Include="Fritz.InstantAPIs" Version="0.2.0-preview-1" />
paket add Fritz.InstantAPIs --version 0.2.0-preview-1
#r "nuget: Fritz.InstantAPIs, 0.2.0-preview-1"
// Install Fritz.InstantAPIs as a Cake Addin #addin nuget:?package=Fritz.InstantAPIs&version=0.2.0-preview-1&prerelease // Install Fritz.InstantAPIs as a Cake Tool #tool nuget:?package=Fritz.InstantAPIs&version=0.2.0-preview-1&prerelease
InstantAPIs
A proof-of-concept library that generates Minimal API endpoints for an Entity Framework context.
For a given Entity Framework context, MyContext
public class MyContext : DbContext
{
public MyContext(DbContextOptions<MyContext> options) : base(options) {}
public DbSet<Contact> Contacts => Set<Contact>();
public DbSet<Address> Addresses => Set<Address>();
}
We can generate all of the standard CRUD API endpoints using this syntax in Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSqlite<MyContext>("Data Source=contacts.db");
var app = builder.Build();
app.MapInstantAPIs<MyContext>();
app.Run();
Now we can navigate to /api/Contacts
and see all of the Contacts in the database. We can filter for a specific Contact by navigating to /api/Contacts/1
to get just the first contact returned. We can also post to /api/Contacts
and add a new Contact to the database. Since there are multiple DbSet
, you can make the same calls to /api/Addresses
.
Community
This project is covered by a code of conduct that all contributors must abide by. Contributions are welcome and encouraged..
Product | Versions 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. |
-
net6.0
- Microsoft.EntityFrameworkCore (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Fritz.InstantAPIs:
Repository | Stars |
---|---|
csharpfritz/csharp_with_csharpfritz
Show notes, slides, and samples from the CSharp with CSharpFritz show
|
Version | Downloads | Last updated |
---|---|---|
0.2.0 | 1,431 | 3/22/2022 |
0.2.0-preview-3 | 214 | 2/27/2022 |
0.2.0-preview-2 | 183 | 2/24/2022 |
0.2.0-preview-1 | 217 | 2/23/2022 |
0.1.0 | 508 | 2/17/2022 |
Introduced a fluent configuration API for defining which tables to include and exclude from the Entity Framework Context.