Rystem.RepositoryFramework.Abstractions 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Abstractions --version 1.1.3
                    
NuGet\Install-Package Rystem.RepositoryFramework.Abstractions -Version 1.1.3
                    
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.Abstractions" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.RepositoryFramework.Abstractions" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.RepositoryFramework.Abstractions" />
                    
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.Abstractions --version 1.1.3
                    
#r "nuget: Rystem.RepositoryFramework.Abstractions, 1.1.3"
                    
#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.
#addin nuget:?package=Rystem.RepositoryFramework.Abstractions&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.RepositoryFramework.Abstractions&version=1.1.3
                    
Install as a Cake Tool

What is Rystem?

Interfaces

Based on CQRS we could split our repository pattern in two main interfaces, one for update (write, delete) and one for read.

Command (Write-Delete)
public interface ICommandPattern<T, TKey, TState> : ICommandPattern
    where TKey : notnull
    where TState : class, IState
{
    Task<TState> InsertAsync(TKey key, T value, CancellationToken cancellationToken = default);
    Task<TState> UpdateAsync(TKey key, T value, CancellationToken cancellationToken = default);
    Task<TState> DeleteAsync(TKey key, CancellationToken cancellationToken = default);
    Task<List<BatchResult<TKey, TState>>> BatchAsync(List<BatchOperation<T, TKey>> operations, CancellationToken cancellationToken = default);
}
Query (Read)
public interface IQueryPattern<T, TKey, TState> : IQueryPattern
    where TKey : notnull
    where TState : class, IState
{
    Task<T?> GetAsync(TKey key, CancellationToken cancellationToken = default);
    Task<TState> ExistAsync(TKey key, CancellationToken cancellationToken = default);
    Task<IEnumerable<T>> QueryAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
    Task<long> CountAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
}
Repository Pattern (Write-Delete-Read)

Repository pattern is a sum of CQRS interfaces.

public interface IRepositoryPattern<T, TKey, TState> : ICommandPattern<T, TKey, TState>, IQueryPattern<T, TKey, TState>, IRepositoryPattern, ICommandPattern, IQueryPattern
    where TKey : notnull
    where TState : class, IState
{
}

With State as TState

Command (Write-Delete)
public interface ICommandPattern<T, TKey> : ICommandPattern<T, TKey, State>, ICommandPattern
    where TKey : notnull
{
    Task<State> InsertAsync(TKey key, T value, CancellationToken cancellationToken = default);
    Task<State> UpdateAsync(TKey key, T value, CancellationToken cancellationToken = default);
    Task<State> DeleteAsync(TKey key, CancellationToken cancellationToken = default);
    Task<List<BatchResult<TKey, State>>> BatchAsync(List<BatchOperation<T, TKey>> operations, CancellationToken cancellationToken = default);
}
Query (Read)
public interface IQueryPattern<T, TKey> : IQueryPattern<T, TKey, State>, IQueryPattern
    where TKey : notnull
{
    Task<T?> GetAsync(TKey key, CancellationToken cancellationToken = default);
    Task<State> ExistAsync(TKey key, CancellationToken cancellationToken = default);
    Task<IEnumerable<T>> QueryAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
    Task<long> CountAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
}
Repository Pattern (Write-Delete-Read)

Repository pattern is a sum of CQRS interfaces.

public interface IRepositoryPattern<T, TKey> : IRepositoryPattern<T, TKey, State>, ICommandPattern<T, TKey>, IQueryPattern<T, TKey>, IRepositoryPattern, ICommandPattern, IQueryPattern
    where TKey : notnull
{
}

With State as TState and string as TKey

Command (Write-Delete)
public interface ICommandPattern<T> : ICommandPattern<T, string>, ICommandPattern
{
    Task<State> InsertAsync(string key, T value, CancellationToken cancellationToken = default);
    Task<State> UpdateAsync(string key, T value, CancellationToken cancellationToken = default);
    Task<State> DeleteAsync(string key, CancellationToken cancellationToken = default);
    Task<List<BatchResult<string, State>>> BatchAsync(List<BatchOperation<T, string>> operations, CancellationToken cancellationToken = default);
}
Query (Read)
public interface IQueryPattern<T> : IQueryPattern<T, string>, IQueryPattern
{
    Task<T?> GetAsync(string key, CancellationToken cancellationToken = default);
    Task<State> ExistAsync(string key, CancellationToken cancellationToken = default);
    Task<IEnumerable<T>> QueryAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
    Task<long> CountAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default);
}
Repository Pattern (Write-Delete-Read)

Repository pattern is a sum of CQRS interfaces.

public interface IRepositoryPattern<T> : IRepositoryPattern<T, string>, ICommandPattern<T>, IQueryPattern<T>, IRepositoryPattern, ICommandPattern, IQueryPattern
    where TKey : notnull
{
}    

Examples

Model
public class User
{
    public string Id { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
}
Command
public class UserWriter : ICommandPattern<User, string>
{
    public Task<State> DeleteAsync(string key, CancellationToken cancellationToken = default)
    {
        //delete on with DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> InsertAsync(string key, User value, CancellationToken cancellationToken = default)
    {
        //insert on DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> UpdateAsync(string key, User value, CancellationToken cancellationToken = default)
    {
        //update on DB or storage context
        throw new NotImplementedException();
    }
    public Task<List<BatchResult<string, State>>> BatchAsync(List<BatchOperation<User, string>> operations, CancellationToken cancellationToken = default)
    {
        //insert, update or delete some items on DB or storage context
        throw new NotImplementedException();
    }
}
Query
public class UserReader : IQueryPattern<User, string>
{
    public Task<User?> GetAsync(string key, CancellationToken cancellationToken = default)
    {
        //get an item by key from DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> ExistAsync(string key, CancellationToken cancellationToken = default)
    {
        //check if an item by key exists in DB or storage context
        throw new NotImplementedException();
    }
    public Task<IEnumerable<User>> QueryAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default)
    {
        //get a list of items by a predicate with top and skip from DB or storage context
        throw new NotImplementedException();
    }
    public Task<long> CountAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default)
    {
        //get an items count by a predicate with top and skip from DB or storage context
        throw new NotImplementedException();
    }
}
Alltogether as repository pattern

if you don't have CQRS infrastructure (usually it's correct to use CQRS when you have minimum two infrastructures one for write and delete and at least one for read)

public class UserRepository : IRepositoryPattern<User, string>, IQueryPattern<User, string>, ICommandPattern<User, string>
{
    public Task<State> DeleteAsync(string key, CancellationToken cancellationToken = default)
    {
        //delete on with DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> InsertAsync(string key, User value, CancellationToken cancellationToken = default)
    {
        //insert on DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> UpdateAsync(string key, User value, CancellationToken cancellationToken = default)
    {
        //update on DB or storage context
        throw new NotImplementedException();
    }
    public Task<List<BatchResult<string, State>>> BatchAsync(List<BatchOperation<User, string>> operations, CancellationToken cancellationToken = default)
    {
        //insert, update or delete some items on DB or storage context
        throw new NotImplementedException();
    }
    public Task<User?> GetAsync(string key, CancellationToken cancellationToken = default)
    {
        //get an item by key from DB or storage context
        throw new NotImplementedException();
    }
    public Task<State> ExistAsync(string key, CancellationToken cancellationToken = default)
    {
        //check if an item by key exists in DB or storage context
        throw new NotImplementedException();
    }
    public Task<IEnumerable<User>> QueryAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default)
    {
        //get a list of items by a predicate with top and skip from DB or storage context
        throw new NotImplementedException();
    }
    public Task<long> CountAsync(QueryOptions<T>? options = null, CancellationToken cancellationToken = default)
    {
        //get an items count by a predicate with top and skip from DB or storage context
        throw new NotImplementedException();
    }
}

How to use it

In DI you install the service

services.AddRepository<User, string, UserRepository>();

And you may inject the object

IRepository<User, string> repository

Query and Command

In DI you install the services

services.AddCommand<User, string, UserWriter>();
services.AddQuery<User, string, UserReader>();

And you may inject the objects

ICommand<User, string> command
IQuery<User, string> command

Example with default key

In DI you install the services

services.AddRepository<User, UserRepository>();
services.AddCommand<User, UserWriter>();
services.AddQuery<User, UserReader>();

And you may inject the objects

IRepository<User> repository
ICommand<User> command
IQuery<User> command

Example with TState

In DI you install the services, in example we are using a Result class that is an IState, instead the default integration State.

services.AddRepository<User, string, Result, UserRepository>();
services.AddCommand<User, string, Result, UserWriter>();
services.AddQuery<User, string, Result, UserReader>();

And you may inject the objects

IRepository<User, string, Result> repository
ICommand<User, string, Result> command
IQuery<User, string, Result> command
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 (13)

Showing the top 5 NuGet packages that depend on Rystem.RepositoryFramework.Abstractions:

Package Downloads
Rystem.RepositoryFramework.Api.Server

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

Rystem.RepositoryFramework.Api.Client

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

Rystem.RepositoryFramework.Infrastructure.Azure.Storage.Blob

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

Rystem.RepositoryFramework.Infrastructure.Azure.Storage.Table

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

Rystem.RepositoryFramework.Cache

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.2 189,904 5/29/2025
9.1.1 97,948 5/2/2025
9.0.32 186,746 4/15/2025
9.0.31 5,892 4/2/2025
9.0.30 88,854 3/26/2025
9.0.29 9,070 3/18/2025
9.0.28 264 3/17/2025
9.0.27 256 3/16/2025
9.0.26 292 3/13/2025
9.0.25 52,179 3/9/2025
9.0.23 150 3/9/2025
9.0.21 799 3/6/2025
9.0.20 19,618 3/6/2025
9.0.19 326 3/6/2025
9.0.18 337 3/4/2025
9.0.17 212 3/1/2025
9.0.16 198 3/1/2025
9.0.15 75,574 2/22/2025
9.0.14 22,626 2/18/2025
9.0.13 230 2/9/2025
9.0.12 218,051 1/13/2025
9.0.11 24,066 1/9/2025
9.0.10 148 1/9/2025
9.0.9 4,068 1/7/2025
9.0.8 12,560 1/6/2025
9.0.7 192 1/6/2025
9.0.5 19,117 12/30/2024
9.0.4 92,334 12/23/2024
9.0.3 213 12/22/2024
9.0.2 10,741 12/21/2024
9.0.1 1,240 12/21/2024
9.0.0 173,157 11/16/2024
9.0.0-rc.1 172 10/18/2024
6.2.0 219,629 10/9/2024
6.1.1 272 10/9/2024
6.1.0 48,138 9/29/2024
6.0.24 393 9/11/2024
6.0.23 340,298 7/18/2024
6.0.21 334 6/18/2024
6.0.20 727,921 6/16/2024
6.0.19 31,015 6/14/2024
6.0.18 317 6/14/2024
6.0.17 296 6/14/2024
6.0.16 50,204 6/10/2024
6.0.15 301 6/9/2024
6.0.14 94,661 5/24/2024
6.0.13 325 5/23/2024
6.0.12 291 5/23/2024
6.0.11 342 5/20/2024
6.0.9 332 5/19/2024
6.0.7 304 5/18/2024
6.0.6 333 5/10/2024
6.0.5 281 5/10/2024
6.0.4 550,273 4/3/2024
6.0.3 1,895 3/25/2024
6.0.2 378,225 3/11/2024
6.0.1 51,216 3/8/2024
6.0.0 1,172,031 11/21/2023
6.0.0-rc.6 166 10/25/2023
6.0.0-rc.5 139 10/25/2023
6.0.0-rc.4 119 10/23/2023
6.0.0-rc.3 109 10/19/2023
6.0.0-rc.2 145 10/18/2023
6.0.0-rc.1 160 10/16/2023
5.0.20 641,530 9/25/2023
5.0.19 3,218 9/10/2023
5.0.18 2,486 9/6/2023
5.0.17 2,386 9/6/2023
5.0.16 2,438 9/5/2023
5.0.15 2,414 9/5/2023
5.0.14 2,459 9/5/2023
5.0.13 2,472 9/1/2023
5.0.12 2,342 8/31/2023
5.0.11 2,367 8/30/2023
5.0.10 2,402 8/29/2023
5.0.9 2,465 8/24/2023
5.0.8 2,507 8/24/2023
5.0.7 451,987 8/23/2023
5.0.6 19,856 8/21/2023
5.0.5 6,630 8/21/2023
5.0.4 2,512 8/16/2023
5.0.3 215,039 8/2/2023
5.0.2 4,336 8/2/2023
5.0.1 14,124 8/1/2023
5.0.0 14,515 7/31/2023
4.1.26 143,358 7/20/2023
4.1.25 27,172 7/16/2023
4.1.24 400,578 6/13/2023
4.1.23 48,273 6/13/2023
4.1.22 132,224 5/30/2023
4.1.21 58,234 5/20/2023
4.1.20 407,623 4/19/2023
4.1.19 98,393 3/20/2023
4.1.18 2,941 3/20/2023
4.1.17 3,189 3/16/2023
4.1.16 2,938 3/16/2023
4.1.15 2,912 3/15/2023
4.1.14 10,612 3/9/2023
4.1.13 3,046 3/7/2023
4.1.12 3,529 2/9/2023
4.1.11 3,101 1/26/2023
4.1.10 3,342 1/22/2023
4.1.9 2,995 1/20/2023
4.1.8 3,270 1/18/2023
4.1.7 3,209 1/18/2023
4.1.6 3,300 1/17/2023
4.1.1 3,236 1/4/2023
4.1.0 3,120 1/1/2023
3.1.5 3,094 12/21/2022
3.1.4 1,581 12/21/2022
3.1.3 3,383 12/12/2022
3.1.2 3,129 12/7/2022
3.1.1 3,212 12/7/2022
3.1.0 3,199 12/1/2022
3.0.29 3,162 12/1/2022
3.0.28 3,994 12/1/2022
3.0.27 3,364 11/23/2022
3.0.25 7,550 11/23/2022
3.0.24 4,613 11/18/2022
3.0.23 4,257 11/18/2022
3.0.22 4,407 11/15/2022
3.0.21 4,447 11/14/2022
3.0.20 4,514 11/13/2022
3.0.19 4,803 11/2/2022
3.0.18 4,558 11/2/2022
3.0.17 4,616 10/29/2022
3.0.16 4,691 10/29/2022
3.0.15 1,682 10/29/2022
3.0.14 7,522 10/24/2022
3.0.13 4,782 10/24/2022
3.0.12 4,763 10/17/2022
3.0.11 4,714 10/10/2022
3.0.10 4,271 10/6/2022
3.0.9 4,216 10/6/2022
3.0.8 4,175 10/6/2022
3.0.7 4,281 10/6/2022
3.0.6 4,289 10/5/2022
3.0.5 4,182 10/5/2022
3.0.4 4,241 10/5/2022
3.0.3 4,221 10/3/2022
3.0.2 4,296 9/30/2022
3.0.1 4,232 9/29/2022
3.0.0 1,719 9/29/2022
2.0.17 3,874 9/29/2022
2.0.16 4,342 9/27/2022
2.0.15 4,454 9/27/2022
2.0.14 4,361 9/26/2022
2.0.13 4,315 9/26/2022
2.0.12 4,274 9/26/2022
2.0.11 4,231 9/25/2022
2.0.10 4,430 9/25/2022
2.0.9 4,314 9/22/2022
2.0.8 4,217 9/22/2022
2.0.7 1,730 9/22/2022
2.0.6 4,225 9/20/2022
2.0.5 4,451 9/20/2022
2.0.4 4,311 9/20/2022
2.0.2 4,325 9/20/2022
2.0.1 4,548 9/13/2022
2.0.0 4,416 8/19/2022
1.1.24 4,439 7/30/2022
1.1.23 4,391 7/29/2022
1.1.22 4,178 7/29/2022
1.1.21 4,602 7/29/2022
1.1.20 4,348 7/29/2022
1.1.19 4,382 7/27/2022
1.1.17 4,408 7/27/2022
1.1.16 4,385 7/26/2022
1.1.15 4,440 7/25/2022
1.1.14 4,381 7/25/2022
1.1.13 4,283 7/22/2022
1.1.12 4,296 7/19/2022
1.1.11 4,360 7/19/2022
1.1.10 4,362 7/19/2022
1.1.9 4,370 7/19/2022
1.1.8 4,451 7/18/2022
1.1.7 4,293 7/18/2022
1.1.6 4,381 7/18/2022
1.1.5 4,350 7/17/2022
1.1.4 1,705 7/17/2022
1.1.3 6,903 7/17/2022
1.1.2 4,442 7/17/2022
1.1.1 1,745 7/17/2022
1.1.0 4,356 7/17/2022
1.0.2 4,346 7/15/2022
1.0.1 3,031 7/15/2022
1.0.0 5,550 7/8/2022
0.10.7 4,363 7/7/2022
0.10.6 1,795 7/7/2022
0.10.3 2,245 7/7/2022
0.10.2 5,803 7/2/2022
0.10.1 4,364 7/1/2022
0.10.0 4,150 7/1/2022
0.9.10 5,464 6/20/2022
0.9.9 4,415 6/11/2022
0.9.8 1,724 6/10/2022
0.9.7 4,291 6/9/2022
0.9.6 4,303 6/5/2022
0.9.5 2,932 6/3/2022
0.9.3 4,199 6/3/2022
0.9.2 2,506 5/31/2022
0.9.1 2,468 5/31/2022
0.9.0 2,447 5/31/2022
0.8.3-beta.1 156 5/31/2022
0.8.2 1,771 5/30/2022
0.8.1 1,783 5/29/2022