Rystem.RepositoryFramework.Api.Server 10.0.1

dotnet add package Rystem.RepositoryFramework.Api.Server --version 10.0.1
                    
NuGet\Install-Package Rystem.RepositoryFramework.Api.Server -Version 10.0.1
                    
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="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.RepositoryFramework.Api.Server" Version="10.0.1" />
                    
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 10.0.1
                    
#r "nuget: Rystem.RepositoryFramework.Api.Server, 10.0.1"
                    
#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@10.0.1
                    
#: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=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.RepositoryFramework.Api.Server&version=10.0.1
                    
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.

 services.AddApiFromRepositoryFramework()
    .WithDescriptiveName("Repository Api")
    .WithPath(Path)
    .WithSwagger()
    .WithVersion(Version)
    .WithDocumentation()
    .WithDefaultCors("http://example.com");

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 setup of three populated repositories, two of them are of the same kind (SuperUser). The SuperiorUser will be added to the app but will be not exposed as Api cause the SetNotExposable() method. Futhermore, we are adding a configuration for AAD to implement authentication on api.

var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddRepository<SuperUser, string>(settins =>
{
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    });
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(2, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    }, "inmemory");
});

builder.Services.AddRepository<SuperiorUser, string>(settings =>
{
    settings.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com")
            .WithPattern(x => x.Value!.Port, @"[1-9]{3,4}");
    });
    settings.SetNotExposable();
});
    
builder.Services.AddApiFromRepositoryFramework()
    .WithDescriptiveName("Repository Api")
    .WithPath(Path)
    .WithSwagger()
    .WithVersion(Version)
    .WithDocumentation()
    .WithDefaultCors("http://example.com");  

var app = builder.Build();
await app.Services.WarmUpAsync();

app.UseHttpsRedirection();
app.UseApiFromRepositoryFramework()
    .WithDefaultAuthorization();
app.Run();

No Authorization flow - default

var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddRepository<SuperUser, string>(settins =>
{
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    });
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(2, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    }, "inmemory");
});

builder.Services.AddRepository<SuperiorUser, string>(settings =>
{
    settings.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com")
            .WithPattern(x => x.Value!.Port, @"[1-9]{3,4}");
    });
    settings.SetNotExposable();
});
builder.Services.AddApiFromRepositoryFramework()
    .WithDescriptiveName("Repository Api")
    .WithPath(Path)
    .WithSwagger()
    .WithVersion(Version)
    .WithDocumentation()
    .WithDefaultCors("http://example.com");    

var app = builder.Build();
await app.Services.WarmUpAsync();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseApiFromRepositoryFramework()
    .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
.AddRepository<SuperUser, string>(settins =>
{
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    });
    settins.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(2, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com");
    }, "inmemory");
});

builder.Services.AddRepository<SuperiorUser, string>(settings =>
{
    settings.WithInMemory(builder =>
    {
        builder
            .PopulateWithRandomData(120, 5)
            .WithPattern(x => x.Value!.Email, @"[a-z]{5,10}@gmail\.com")
            .WithPattern(x => x.Value!.Port, @"[1-9]{3,4}");
    });
    settings.SetNotExposable();
});

builder.Services.AddAuthorization(
    options =>
    {
        options.AddPolicy("NormalUser", x =>
        {
            x.RequireClaim(ClaimTypes.Name);
        });
        options.AddPolicy("SuperAdmin", x =>
        {
            x.RequireRole("SuperAdmin");
        });
    });

builder.Services.AddApiFromRepositoryFramework()
    .WithDescriptiveName("Repository Api")
    .WithPath(Path)
    .WithSwagger()
    .WithVersion(Version)
    .WithDocumentation()
    .WithDefaultCors("http://example.com");     

var app = builder.Build();
await app.Services.WarmUpAsync();
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();

app.UseEndpoints(endpoints =>
{
    endpoints.MapHealthChecks("/healthz");
    endpoints.UseApiFromRepository<SuperUser>()
        .SetPolicyForCommand()
        .With("SuperAdmin")
        .Build();
    endpoints.UseApiFromRepositoryFramework()
        .SetPolicyForAll()
        .With("NormalUser")
        .And()
        .SetPolicy(RepositoryMethods.Insert)
        .With("SuperAdmin")
        .And()
        .SetPolicy(RepositoryMethods.Update)
        .With("SuperAdmin")
        .Build();
    endpoints
        .MapControllers();
});
app.Run();

In this example, I'm configuring a policy named "NormalUser" for all methods and all repositories, and a policy named "SuperAdmin" for the methods Insert and Update for all repositories and for the command (Insert, Updated and Delete) of SuperUser repository. You can customize it repository for repository, using UseApiFromRepository<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 net10.0 is compatible.  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
10.0.1 15,829 11/12/2025
9.1.3 275 9/2/2025
9.1.2 764,538 5/29/2025
9.1.1 97,821 5/2/2025
9.0.33 235 4/30/2025
9.0.32 186,677 4/15/2025
9.0.31 5,853 4/2/2025
9.0.30 88,889 3/26/2025
9.0.29 9,030 3/18/2025
9.0.28 248 3/17/2025
9.0.27 258 3/16/2025
9.0.26 253 3/13/2025
9.0.25 52,164 3/9/2025
9.0.21 383 3/6/2025
9.0.20 19,612 3/6/2025
9.0.19 338 3/6/2025
9.0.18 324 3/4/2025
9.0.17 225 3/1/2025
9.0.16 223 3/1/2025
9.0.15 75,566 2/22/2025
9.0.14 22,613 2/18/2025
9.0.13 245 2/9/2025
9.0.12 217,726 1/13/2025
9.0.11 24,068 1/9/2025
9.0.10 192 1/9/2025
9.0.9 4,049 1/7/2025
9.0.8 12,563 1/6/2025
9.0.7 184 1/6/2025
9.0.4 92,362 12/23/2024
9.0.3 229 12/22/2024
9.0.2 10,771 12/21/2024
9.0.1 1,251 12/21/2024
9.0.0 173,114 11/16/2024
9.0.0-rc.1 140 10/18/2024
6.2.0 219,085 10/9/2024
6.1.1 235 10/9/2024
6.1.0 48,032 9/29/2024
6.0.24 296 9/11/2024
6.0.23 340,236 7/18/2024
6.0.21 258 6/18/2024
6.0.20 727,838 6/16/2024
6.0.19 30,492 6/14/2024
6.0.18 264 6/14/2024
6.0.17 238 6/14/2024
6.0.16 50,080 6/10/2024
6.0.15 227 6/9/2024
6.0.14 94,374 5/24/2024
6.0.13 277 5/23/2024
6.0.12 237 5/23/2024
6.0.11 262 5/20/2024
6.0.9 215 5/20/2024
6.0.7 187 5/18/2024
6.0.6 261 5/10/2024
6.0.5 261 5/10/2024
6.0.4 549,906 4/3/2024
6.0.3 1,540 3/25/2024
6.0.2 393,692 3/11/2024
6.0.0 1,171,253 11/21/2023
6.0.0-rc.6 182 10/25/2023
6.0.0-rc.5 133 10/25/2023
6.0.0-rc.4 144 10/23/2023
6.0.0-rc.3 132 10/19/2023
6.0.0-rc.2 150 10/18/2023
6.0.0-rc.1 133 10/16/2023
5.0.20 638,674 9/25/2023
5.0.19 1,033 9/10/2023
5.0.18 1,016 9/6/2023
5.0.17 1,000 9/6/2023
5.0.16 1,064 9/5/2023
5.0.15 1,017 9/5/2023
5.0.14 977 9/5/2023
5.0.13 979 9/1/2023
5.0.12 1,001 8/31/2023
5.0.11 996 8/30/2023
5.0.10 990 8/29/2023
5.0.9 1,008 8/24/2023
5.0.8 1,035 8/24/2023
5.0.7 450,484 8/23/2023
5.0.6 18,359 8/21/2023
5.0.5 5,182 8/21/2023
5.0.4 1,043 8/16/2023
5.0.3 213,434 8/2/2023
5.0.2 2,678 8/2/2023
5.0.1 12,523 8/1/2023
5.0.0 12,760 7/31/2023
4.1.26 141,546 7/20/2023
4.1.25 25,546 7/16/2023
4.1.24 398,641 6/13/2023
4.1.23 46,604 6/13/2023
4.1.22 130,436 5/30/2023
4.1.21 56,327 5/20/2023
4.1.20 405,528 4/19/2023
4.1.19 96,353 3/20/2023
4.1.18 1,242 3/20/2023
4.1.17 1,226 3/16/2023
4.1.16 1,211 3/16/2023
4.1.15 1,195 3/15/2023
4.1.14 1,772 3/9/2023
4.1.13 1,203 3/7/2023
4.1.12 1,436 2/10/2023
4.1.11 1,304 1/26/2023
4.1.10 1,289 1/22/2023
4.1.9 1,270 1/20/2023
4.1.8 1,223 1/18/2023
4.1.7 1,456 1/18/2023
4.1.6 1,323 1/17/2023
4.1.1 1,301 1/4/2023
4.1.0 1,355 1/1/2023
3.1.5 1,292 12/21/2022
3.1.3 1,301 12/12/2022
3.1.2 1,283 12/7/2022
3.1.1 1,281 12/7/2022
3.1.0 1,328 12/2/2022
3.0.29 1,319 12/1/2022
3.0.28 1,306 12/1/2022
3.0.27 1,483 11/23/2022
3.0.25 1,358 11/23/2022
3.0.24 1,339 11/18/2022
3.0.23 1,324 11/18/2022
3.0.22 1,363 11/15/2022
3.0.21 1,365 11/14/2022
3.0.20 1,379 11/13/2022
3.0.19 1,578 11/2/2022
3.0.18 1,342 11/2/2022
3.0.17 1,360 10/29/2022
3.0.16 1,364 10/29/2022
3.0.15 1,315 10/29/2022
3.0.14 1,445 10/24/2022
3.0.13 1,398 10/24/2022
3.0.12 1,441 10/17/2022
3.0.11 1,439 10/10/2022
3.0.10 1,458 10/6/2022
3.0.9 1,372 10/6/2022
3.0.8 1,365 10/6/2022
3.0.7 1,395 10/6/2022
3.0.6 1,389 10/5/2022
3.0.5 1,386 10/5/2022
3.0.4 1,358 10/5/2022
3.0.3 1,398 10/3/2022
3.0.2 1,399 9/30/2022
3.0.1 1,391 9/29/2022
2.0.17 1,404 9/29/2022
2.0.16 1,393 9/27/2022
2.0.15 1,483 9/27/2022
2.0.14 1,413 9/26/2022
2.0.13 1,477 9/26/2022
2.0.12 1,425 9/26/2022
2.0.11 1,403 9/25/2022
2.0.10 1,482 9/25/2022
2.0.9 1,472 9/22/2022
2.0.8 1,450 9/22/2022
2.0.6 1,409 9/20/2022
2.0.5 1,434 9/20/2022
2.0.4 1,424 9/20/2022
2.0.2 1,423 9/20/2022
2.0.1 1,521 9/13/2022
2.0.0 1,442 8/19/2022
1.1.24 1,460 7/30/2022
1.1.23 1,412 7/29/2022
1.1.22 1,433 7/29/2022
1.1.21 1,469 7/29/2022
1.1.20 1,450 7/29/2022
1.1.19 1,531 7/27/2022
1.1.17 1,411 7/27/2022
1.1.16 1,444 7/26/2022
1.1.15 1,479 7/25/2022
1.1.14 1,469 7/25/2022
1.1.13 1,421 7/22/2022
1.1.12 1,502 7/19/2022
1.1.11 1,464 7/19/2022
1.1.10 1,465 7/19/2022
1.1.9 1,471 7/19/2022
1.1.8 1,487 7/18/2022
1.1.7 1,454 7/18/2022
1.1.6 1,469 7/18/2022
1.1.5 1,445 7/17/2022
1.1.4 1,488 7/17/2022
1.1.3 1,493 7/17/2022
1.1.2 1,511 7/17/2022
1.1.0 1,454 7/17/2022
1.0.2 1,463 7/15/2022
1.0.1 1,408 7/15/2022
1.0.0 1,463 7/8/2022
0.10.7 1,478 7/7/2022
0.10.2 1,498 7/2/2022
0.10.1 1,433 7/1/2022
0.10.0 1,449 7/1/2022
0.9.11 1,480 6/29/2022
0.9.10 1,460 6/20/2022
0.9.9 1,435 6/11/2022
0.9.7 1,497 6/9/2022
0.9.6 1,452 6/5/2022
0.9.5 1,470 6/3/2022
0.9.4 1,460 6/3/2022
0.9.3 1,438 6/3/2022
0.9.2 1,447 5/31/2022
0.9.1 1,459 5/31/2022
0.9.0 1,427 5/31/2022