Rystem.RepositoryFramework.Api.Server 3.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Api.Server --version 3.0.5
                    
NuGet\Install-Package Rystem.RepositoryFramework.Api.Server -Version 3.0.5
                    
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="Rystem.RepositoryFramework.Api.Server" Version="3.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.RepositoryFramework.Api.Server" Version="3.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.RepositoryFramework.Api.Server" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rystem.RepositoryFramework.Api.Server --version 3.0.5
                    
#r "nuget: Rystem.RepositoryFramework.Api.Server, 3.0.5"
                    
#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.
#:package Rystem.RepositoryFramework.Api.Server@3.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rystem.RepositoryFramework.Api.Server&version=3.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.RepositoryFramework.Api.Server&version=3.0.5
                    
Install as a Cake Tool

What is Rystem?

Api auto-generated

In your web application you have only to add one row after service build.

builder.Services.AddApiFromRepositoryFramework(x =>
{
    x.Name = "Repository Api";
    x.HasSwagger = true;
    x.HasDocumentation = true;
    x.Identity.ConfigureAzureActiveDirectory(builder.Configuration);
});

var app = builder.Build();
app.UseApiFromRepositoryFramework()
   .WithNoAuthorization();

public static ApiAuthorizationBuilder UseApiFromRepositoryFramework<TEndpointRouteBuilder>(
    this TEndpointRouteBuilder app,
    string startingPath = "api")
    where TEndpointRouteBuilder : IEndpointRouteBuilder

You may add api for each service by

public static ApiAuthorizationBuilder UseApiForRepository<T>(this IEndpointRouteBuilder app,
    string startingPath = "api")

Startup example

In the example below you may find the DI for repository with string key for User model, populated with random data in memory, swagger to test the solution, the population method just after the build and the configuration of your API based on repository framework. Futhermore, we are adding a configuration for AAD to implement authentication on api.

var builder = WebApplication.CreateBuilder(args);
builder.Services
    .AddRepositoryInMemoryStorage<User>()
    .PopulateWithRandomData(x => x.Email!, 120, 5);
builder.Services.AddApiFromRepositoryFramework(x =>
{
    x.Name = "Repository Api";
    x.HasSwagger = true;
    x.HasDocumentation = true;
    x.Identity.ConfigureAzureActiveDirectory(builder.Configuration);
});    

var app = builder.Build();
app.Services.Populate();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseApiForRepositoryFramework()
    .WithDefaultAuthorization();
app.Run();

No Authorization flow - default

var builder = WebApplication.CreateBuilder(args);
builder.Services
    .AddRepositoryInMemoryStorage<User>()
    .PopulateWithRandomData(x => x.Email!, 120, 5);
builder.Services.AddApiFromRepositoryFramework(x =>
{
    x.Name = "Repository Api";
    x.HasSwagger = true;
    x.HasDocumentation = true;
});    

var app = builder.Build();
app.Services.Populate();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseApiForRepositoryFramework()
    .WithNoAuthorization();
app.Run();

Authorization flow - custom policies

You may configure the scoper for each method of your repository and for each repository, as you wish.

var builder = WebApplication.CreateBuilder(args);
builder.Services
    .AddRepositoryInMemoryStorage<User>()
    .PopulateWithRandomData(x => x.Email!, 120, 5);
builder.Services.AddApiFromRepositoryFramework(x =>
{
    x.Name = "Repository Api";
    x.HasSwagger = true;
    x.HasDocumentation = true;
    x.Identity.ConfigureAzureActiveDirectory(builder.Configuration);
});    

var app = builder.Build();
app.Services.Populate();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseApiForRepositoryFramework()
    .SetPolicyForAll()
    .With("Normal User")
    .And()
    .SetPolicy(RepositoryMethod.Insert)
    .With("Admin")
    .And()
    .SetPolicy(RepositoryMethod.Update)
    .With("Admin")
    .And()
    .Finalize();

app.Run();

In this example, I'm configuring a policy named "Normal User" for all methods and all repositories, and a policy named "Admin" for the methods Insert and Update for all repositories. You can customize it repository for repository, using AddApiForRepository<T>() method.

Sample of filter usage when you use the api directly

All the requests are basic requests, the strangest request is only the query and you must use the Linq query. You may find some examples down below:

ƒ => (((ƒ.X == "dasda") AndAlso ƒ.X.Contains("dasda")) AndAlso ((ƒ.E == Guid.Parse("bf46510b-b7e6-4ba2-88da-cef208aa81f2")) Or (ƒ.Id == 32)))
ƒ => ((((ƒ.X == "dasda") AndAlso ƒ.Sol) AndAlso ƒ.X.Contains("dasda")) AndAlso ((ƒ.E == Guid.Parse("bf46510b-b7e6-4ba2-88da-cef208aa81f2")) Or (ƒ.Id == 32)))
ƒ => (((((ƒ.X == "dasda") AndAlso ƒ.Sol) AndAlso ƒ.X.Contains("dasda")) AndAlso ((ƒ.E == Guid.Parse("bf46510b-b7e6-4ba2-88da-cef208aa81f2")) Or (ƒ.Id == 32))) AndAlso ((ƒ.Type == 1) OrElse (ƒ.Type == 2)))
ƒ => (ƒ.Type == 2)
ƒ => (((((ƒ.X == "dasda") AndAlso ƒ.Sol) AndAlso (ƒ.X.Contains("dasda") OrElse ƒ.Sol.Equals(True))) AndAlso ((ƒ.E == Guid.Parse("bf46510b-b7e6-4ba2-88da-cef208aa81f2")) Or (ƒ.Id == 32))) AndAlso ((ƒ.Type == 1) OrElse (ƒ.Type == 2)))
ƒ => ((((((ƒ.X == "dasda") AndAlso ƒ.Samules.Any(x => (x == "ccccde"))) AndAlso ƒ.Sol) AndAlso (ƒ.X.Contains("dasda") OrElse ƒ.Sol.Equals(True))) AndAlso ((ƒ.E == Guid.Parse("bf46510b-b7e6-4ba2-88da-cef208aa81f2")) Or (ƒ.Id == 32))) AndAlso ((ƒ.Type == 1) OrElse (ƒ.Type == 2)))
ƒ => (ƒ.ExpirationTime > Convert.ToDateTime("7/6/2022 9:48:56 AM"))
ƒ => (ƒ.TimeSpan > new TimeSpan(1000 as long))
ƒ => Not(ƒ.Inside.Inside.A.Equals("dasdad"))
ƒ => Not(String.IsNullOrWhiteSpace(ƒ.Inside.Inside.A))
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.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.3 154 9/2/2025
9.1.2 529,582 5/29/2025
9.1.1 97,755 5/2/2025
9.0.33 178 4/30/2025
9.0.32 186,606 4/15/2025
9.0.31 5,787 4/2/2025
9.0.30 88,810 3/26/2025
9.0.29 8,964 3/18/2025
9.0.28 190 3/17/2025
9.0.27 193 3/16/2025
9.0.26 199 3/13/2025
9.0.25 52,085 3/9/2025
9.0.21 321 3/6/2025
9.0.20 19,544 3/6/2025
9.0.19 267 3/6/2025
9.0.18 257 3/4/2025
9.0.17 166 3/1/2025
9.0.16 151 3/1/2025
9.0.15 75,495 2/22/2025
9.0.14 22,554 2/18/2025
9.0.13 167 2/9/2025
9.0.12 217,673 1/13/2025
9.0.11 24,000 1/9/2025
9.0.10 128 1/9/2025
9.0.9 3,995 1/7/2025
9.0.8 12,492 1/6/2025
9.0.7 132 1/6/2025
9.0.4 92,296 12/23/2024
9.0.3 158 12/22/2024
9.0.2 10,698 12/21/2024
9.0.1 1,188 12/21/2024
9.0.0 173,051 11/16/2024
9.0.0-rc.1 109 10/18/2024
6.2.0 219,034 10/9/2024
6.1.1 172 10/9/2024
6.1.0 47,965 9/29/2024
6.0.24 208 9/11/2024
6.0.23 340,163 7/18/2024
6.0.21 195 6/18/2024
6.0.20 727,789 6/16/2024
6.0.19 30,417 6/14/2024
6.0.18 189 6/14/2024
6.0.17 168 6/14/2024
6.0.16 50,019 6/10/2024
6.0.15 171 6/9/2024
6.0.14 94,302 5/24/2024
6.0.13 215 5/23/2024
6.0.12 160 5/23/2024
6.0.11 179 5/20/2024
6.0.9 152 5/20/2024
6.0.7 136 5/18/2024
6.0.6 199 5/10/2024
6.0.5 194 5/10/2024
6.0.4 549,854 4/3/2024
6.0.3 1,468 3/25/2024
6.0.2 393,623 3/11/2024
6.0.0 1,171,190 11/21/2023
6.0.0-rc.6 151 10/25/2023
6.0.0-rc.5 115 10/25/2023
6.0.0-rc.4 115 10/23/2023
6.0.0-rc.3 105 10/19/2023
6.0.0-rc.2 119 10/18/2023
6.0.0-rc.1 111 10/16/2023
5.0.20 638,627 9/25/2023
5.0.19 975 9/10/2023
5.0.18 965 9/6/2023
5.0.17 949 9/6/2023
5.0.16 1,008 9/5/2023
5.0.15 964 9/5/2023
5.0.14 920 9/5/2023
5.0.13 921 9/1/2023
5.0.12 952 8/31/2023
5.0.11 931 8/30/2023
5.0.10 945 8/29/2023
5.0.9 971 8/24/2023
5.0.8 992 8/24/2023
5.0.7 450,446 8/23/2023
5.0.6 18,305 8/21/2023
5.0.5 5,132 8/21/2023
5.0.4 994 8/16/2023
5.0.3 213,380 8/2/2023
5.0.2 2,638 8/2/2023
5.0.1 12,467 8/1/2023
5.0.0 12,719 7/31/2023
4.1.26 141,495 7/20/2023
4.1.25 25,489 7/16/2023
4.1.24 398,581 6/13/2023
4.1.23 46,537 6/13/2023
4.1.22 130,365 5/30/2023
4.1.21 56,272 5/20/2023
4.1.20 405,455 4/19/2023
4.1.19 96,279 3/20/2023
4.1.18 1,173 3/20/2023
4.1.17 1,156 3/16/2023
4.1.16 1,153 3/16/2023
4.1.15 1,122 3/15/2023
4.1.14 1,710 3/9/2023
4.1.13 1,140 3/7/2023
4.1.12 1,365 2/10/2023
4.1.11 1,235 1/26/2023
4.1.10 1,217 1/22/2023
4.1.9 1,207 1/20/2023
4.1.8 1,165 1/18/2023
4.1.7 1,374 1/18/2023
4.1.6 1,238 1/17/2023
4.1.1 1,226 1/4/2023
4.1.0 1,283 1/1/2023
3.1.5 1,225 12/21/2022
3.1.3 1,238 12/12/2022
3.1.2 1,209 12/7/2022
3.1.1 1,199 12/7/2022
3.1.0 1,268 12/2/2022
3.0.29 1,250 12/1/2022
3.0.28 1,235 12/1/2022
3.0.27 1,427 11/23/2022
3.0.25 1,291 11/23/2022
3.0.24 1,265 11/18/2022
3.0.23 1,244 11/18/2022
3.0.22 1,296 11/15/2022
3.0.21 1,298 11/14/2022
3.0.20 1,277 11/13/2022
3.0.19 1,518 11/2/2022
3.0.18 1,275 11/2/2022
3.0.17 1,289 10/29/2022
3.0.16 1,296 10/29/2022
3.0.15 1,253 10/29/2022
3.0.14 1,370 10/24/2022
3.0.13 1,339 10/24/2022
3.0.12 1,371 10/17/2022
3.0.11 1,355 10/10/2022
3.0.10 1,387 10/6/2022
3.0.9 1,313 10/6/2022
3.0.8 1,303 10/6/2022
3.0.7 1,325 10/6/2022
3.0.6 1,310 10/5/2022
3.0.5 1,314 10/5/2022
3.0.4 1,286 10/5/2022
3.0.3 1,320 10/3/2022
3.0.2 1,324 9/30/2022
3.0.1 1,313 9/29/2022
2.0.17 1,336 9/29/2022
2.0.16 1,309 9/27/2022
2.0.15 1,416 9/27/2022
2.0.14 1,350 9/26/2022
2.0.13 1,398 9/26/2022
2.0.12 1,361 9/26/2022
2.0.11 1,318 9/25/2022
2.0.10 1,391 9/25/2022
2.0.9 1,391 9/22/2022
2.0.8 1,374 9/22/2022
2.0.6 1,331 9/20/2022
2.0.5 1,349 9/20/2022
2.0.4 1,346 9/20/2022
2.0.2 1,358 9/20/2022
2.0.1 1,449 9/13/2022
2.0.0 1,364 8/19/2022
1.1.24 1,393 7/30/2022
1.1.23 1,344 7/29/2022
1.1.22 1,360 7/29/2022
1.1.21 1,406 7/29/2022
1.1.20 1,382 7/29/2022
1.1.19 1,451 7/27/2022
1.1.17 1,332 7/27/2022
1.1.16 1,379 7/26/2022
1.1.15 1,402 7/25/2022
1.1.14 1,392 7/25/2022
1.1.13 1,347 7/22/2022
1.1.12 1,429 7/19/2022
1.1.11 1,398 7/19/2022
1.1.10 1,389 7/19/2022
1.1.9 1,384 7/19/2022
1.1.8 1,410 7/18/2022
1.1.7 1,382 7/18/2022
1.1.6 1,390 7/18/2022
1.1.5 1,371 7/17/2022
1.1.4 1,418 7/17/2022
1.1.3 1,415 7/17/2022
1.1.2 1,434 7/17/2022
1.1.0 1,392 7/17/2022
1.0.2 1,372 7/15/2022
1.0.1 1,334 7/15/2022
1.0.0 1,382 7/8/2022
0.10.7 1,400 7/7/2022
0.10.2 1,417 7/2/2022
0.10.1 1,348 7/1/2022
0.10.0 1,354 7/1/2022
0.9.11 1,399 6/29/2022
0.9.10 1,394 6/20/2022
0.9.9 1,361 6/11/2022
0.9.7 1,418 6/9/2022
0.9.6 1,372 6/5/2022
0.9.5 1,394 6/3/2022
0.9.4 1,387 6/3/2022
0.9.3 1,366 6/3/2022
0.9.2 1,374 5/31/2022
0.9.1 1,368 5/31/2022
0.9.0 1,351 5/31/2022