Rystem.RepositoryFramework.Abstractions
0.9.6
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Abstractions --version 0.9.6
NuGet\Install-Package Rystem.RepositoryFramework.Abstractions -Version 0.9.6
<PackageReference Include="Rystem.RepositoryFramework.Abstractions" Version="0.9.6" />
paket add Rystem.RepositoryFramework.Abstractions --version 0.9.6
#r "nuget: Rystem.RepositoryFramework.Abstractions, 0.9.6"
// Install Rystem.RepositoryFramework.Abstractions as a Cake Addin #addin nuget:?package=Rystem.RepositoryFramework.Abstractions&version=0.9.6 // Install Rystem.RepositoryFramework.Abstractions as a Cake Tool #tool nuget:?package=Rystem.RepositoryFramework.Abstractions&version=0.9.6
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
{
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);
}
Query (Read)
public interface IQueryPattern<T, TKey, TState> : IQueryPattern
where TKey : notnull
{
Task<T?> GetAsync(TKey key, CancellationToken cancellationToken = default);
Task<TState> ExistAsync(TKey key, CancellationToken cancellationToken = default);
Task<IEnumerable<T>> QueryAsync(Expression<Func<T, bool>>? predicate = null, int? top = null, int? skip = 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
{
}
With bool as TState
Command (Write-Delete)
public interface ICommandPattern<T, TKey> : ICommandPattern<T, TKey, bool>, ICommandPattern
where TKey : notnull
{
Task<bool> InsertAsync(TKey key, T value, CancellationToken cancellationToken = default);
Task<bool> UpdateAsync(TKey key, T value, CancellationToken cancellationToken = default);
Task<bool> DeleteAsync(TKey key, CancellationToken cancellationToken = default);
}
Query (Read)
public interface IQueryPattern<T, TKey> : IQueryPattern<T, TKey, bool>, IQueryPattern
where TKey : notnull
{
Task<T?> GetAsync(TKey key, CancellationToken cancellationToken = default);
Task<bool> ExistAsync(TKey key, CancellationToken cancellationToken = default);
Task<IEnumerable<T>> QueryAsync(Expression<Func<T, bool>>? predicate = null, int? top = null, int? skip = 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, bool>, ICommandPattern<T, TKey>, IQueryPattern<T, TKey>, IRepositoryPattern, ICommandPattern, IQueryPattern
where TKey : notnull
{
}
With bool as TState and string as TKey
Command (Write-Delete)
public interface ICommandPattern<T> : ICommandPattern<T, string>, ICommandPattern
{
Task<bool> InsertAsync(string key, T value, CancellationToken cancellationToken = default);
Task<bool> UpdateAsync(string key, T value, CancellationToken cancellationToken = default);
Task<bool> DeleteAsync(string key, CancellationToken cancellationToken = default);
}
Query (Read)
public interface IQueryPattern<T> : IQueryPattern<T, string>, IQueryPattern
{
Task<T?> GetAsync(string key, CancellationToken cancellationToken = default);
Task<bool> ExistAsync(string key, CancellationToken cancellationToken = default);
Task<IEnumerable<T>> QueryAsync(Expression<Func<T, bool>>? predicate = null, int? top = null, int? skip = 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<bool> DeleteAsync(string key, CancellationToken cancellationToken = default)
{
//delete on with DB or storage context
throw new NotImplementedException();
}
public Task<bool> InsertAsync(string key, User value, CancellationToken cancellationToken = default)
{
//insert on DB or storage context
throw new NotImplementedException();
}
public Task<bool> UpdateAsync(string key, User value, CancellationToken cancellationToken = default)
{
//update 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<bool> 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(Expression<Func<User, bool>>? predicate = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default)
{
//get a list of items 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<bool> DeleteAsync(string key, CancellationToken cancellationToken = default)
{
//delete on with DB or storage context
throw new NotImplementedException();
}
public Task<bool> InsertAsync(string key, User value, CancellationToken cancellationToken = default)
{
//insert on DB or storage context
throw new NotImplementedException();
}
public Task<bool> UpdateAsync(string key, User value, CancellationToken cancellationToken = default)
{
//update 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<bool> 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(Expression<Func<User, bool>>? predicate = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default)
{
//get a list of items 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 instead the default integration with a return type bool.
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 | 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
NuGet packages (12)
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.0.0 | 147,535 | 11/16/2024 |
9.0.0-rc.1 | 150 | 10/18/2024 |
6.2.0 | 219,431 | 10/9/2024 |
6.1.1 | 230 | 10/9/2024 |
6.1.0 | 48,091 | 9/29/2024 |
6.0.24 | 357 | 9/11/2024 |
6.0.23 | 340,261 | 7/18/2024 |
6.0.21 | 296 | 6/18/2024 |
6.0.20 | 727,877 | 6/16/2024 |
6.0.19 | 30,857 | 6/14/2024 |
6.0.18 | 264 | 6/14/2024 |
6.0.17 | 266 | 6/14/2024 |
6.0.16 | 50,132 | 6/10/2024 |
6.0.15 | 275 | 6/9/2024 |
6.0.14 | 94,600 | 5/24/2024 |
6.0.13 | 284 | 5/23/2024 |
6.0.12 | 240 | 5/23/2024 |
6.0.11 | 306 | 5/20/2024 |
6.0.9 | 297 | 5/19/2024 |
6.0.7 | 268 | 5/18/2024 |
6.0.6 | 295 | 5/10/2024 |
6.0.5 | 240 | 5/10/2024 |
6.0.4 | 550,234 | 4/3/2024 |
6.0.3 | 1,714 | 3/25/2024 |
6.0.2 | 378,197 | 3/11/2024 |
6.0.1 | 51,179 | 3/8/2024 |
6.0.0 | 1,172,018 | 11/21/2023 |
6.0.0-rc.6 | 146 | 10/25/2023 |
6.0.0-rc.5 | 114 | 10/25/2023 |
6.0.0-rc.4 | 99 | 10/23/2023 |
6.0.0-rc.3 | 87 | 10/19/2023 |
6.0.0-rc.2 | 124 | 10/18/2023 |
6.0.0-rc.1 | 136 | 10/16/2023 |
5.0.20 | 641,486 | 9/25/2023 |
5.0.19 | 3,192 | 9/10/2023 |
5.0.18 | 2,460 | 9/6/2023 |
5.0.17 | 2,360 | 9/6/2023 |
5.0.16 | 2,414 | 9/5/2023 |
5.0.15 | 2,372 | 9/5/2023 |
5.0.14 | 2,386 | 9/5/2023 |
5.0.13 | 2,448 | 9/1/2023 |
5.0.12 | 2,310 | 8/31/2023 |
5.0.11 | 2,333 | 8/30/2023 |
5.0.10 | 2,368 | 8/29/2023 |
5.0.9 | 2,433 | 8/24/2023 |
5.0.8 | 2,475 | 8/24/2023 |
5.0.7 | 451,934 | 8/23/2023 |
5.0.6 | 19,829 | 8/21/2023 |
5.0.5 | 6,579 | 8/21/2023 |
5.0.4 | 2,480 | 8/16/2023 |
5.0.3 | 215,005 | 8/2/2023 |
5.0.2 | 4,295 | 8/2/2023 |
5.0.1 | 14,065 | 8/1/2023 |
5.0.0 | 14,452 | 7/31/2023 |
4.1.26 | 143,330 | 7/20/2023 |
4.1.25 | 27,137 | 7/16/2023 |
4.1.24 | 400,543 | 6/13/2023 |
4.1.23 | 48,218 | 6/13/2023 |
4.1.22 | 132,173 | 5/30/2023 |
4.1.21 | 58,202 | 5/20/2023 |
4.1.20 | 407,576 | 4/19/2023 |
4.1.19 | 98,344 | 3/20/2023 |
4.1.18 | 2,895 | 3/20/2023 |
4.1.17 | 3,148 | 3/16/2023 |
4.1.16 | 2,892 | 3/16/2023 |
4.1.15 | 2,848 | 3/15/2023 |
4.1.14 | 10,568 | 3/9/2023 |
4.1.13 | 2,999 | 3/7/2023 |
4.1.12 | 3,456 | 2/9/2023 |
4.1.11 | 3,059 | 1/26/2023 |
4.1.10 | 3,281 | 1/22/2023 |
4.1.9 | 2,943 | 1/20/2023 |
4.1.8 | 3,218 | 1/18/2023 |
4.1.7 | 3,171 | 1/18/2023 |
4.1.6 | 3,238 | 1/17/2023 |
4.1.1 | 3,195 | 1/4/2023 |
4.1.0 | 3,076 | 1/1/2023 |
3.1.5 | 3,031 | 12/21/2022 |
3.1.4 | 1,543 | 12/21/2022 |
3.1.3 | 3,334 | 12/12/2022 |
3.1.2 | 3,092 | 12/7/2022 |
3.1.1 | 3,176 | 12/7/2022 |
3.1.0 | 3,155 | 12/1/2022 |
3.0.29 | 3,122 | 12/1/2022 |
3.0.28 | 3,953 | 12/1/2022 |
3.0.27 | 3,324 | 11/23/2022 |
3.0.25 | 6,893 | 11/23/2022 |
3.0.24 | 4,544 | 11/18/2022 |
3.0.23 | 4,219 | 11/18/2022 |
3.0.22 | 4,363 | 11/15/2022 |
3.0.21 | 4,400 | 11/14/2022 |
3.0.20 | 4,466 | 11/13/2022 |
3.0.19 | 4,758 | 11/2/2022 |
3.0.18 | 4,510 | 11/2/2022 |
3.0.17 | 4,573 | 10/29/2022 |
3.0.16 | 4,651 | 10/29/2022 |
3.0.15 | 1,642 | 10/29/2022 |
3.0.14 | 7,481 | 10/24/2022 |
3.0.13 | 4,701 | 10/24/2022 |
3.0.12 | 4,709 | 10/17/2022 |
3.0.11 | 4,664 | 10/10/2022 |
3.0.10 | 4,225 | 10/6/2022 |
3.0.9 | 4,149 | 10/6/2022 |
3.0.8 | 4,123 | 10/6/2022 |
3.0.7 | 4,236 | 10/6/2022 |
3.0.6 | 4,226 | 10/5/2022 |
3.0.5 | 4,130 | 10/5/2022 |
3.0.4 | 4,197 | 10/5/2022 |
3.0.3 | 4,177 | 10/3/2022 |
3.0.2 | 4,237 | 9/30/2022 |
3.0.1 | 4,180 | 9/29/2022 |
3.0.0 | 1,678 | 9/29/2022 |
2.0.17 | 3,818 | 9/29/2022 |
2.0.16 | 4,298 | 9/27/2022 |
2.0.15 | 4,409 | 9/27/2022 |
2.0.14 | 4,314 | 9/26/2022 |
2.0.13 | 4,238 | 9/26/2022 |
2.0.12 | 4,234 | 9/26/2022 |
2.0.11 | 4,182 | 9/25/2022 |
2.0.10 | 4,379 | 9/25/2022 |
2.0.9 | 4,255 | 9/22/2022 |
2.0.8 | 4,170 | 9/22/2022 |
2.0.7 | 1,685 | 9/22/2022 |
2.0.6 | 4,182 | 9/20/2022 |
2.0.5 | 4,394 | 9/20/2022 |
2.0.4 | 4,257 | 9/20/2022 |
2.0.2 | 4,274 | 9/20/2022 |
2.0.1 | 4,497 | 9/13/2022 |
2.0.0 | 4,364 | 8/19/2022 |
1.1.24 | 4,381 | 7/30/2022 |
1.1.23 | 4,321 | 7/29/2022 |
1.1.22 | 4,131 | 7/29/2022 |
1.1.21 | 4,537 | 7/29/2022 |
1.1.20 | 4,298 | 7/29/2022 |
1.1.19 | 4,326 | 7/27/2022 |
1.1.17 | 4,350 | 7/27/2022 |
1.1.16 | 4,338 | 7/26/2022 |
1.1.15 | 4,386 | 7/25/2022 |
1.1.14 | 4,335 | 7/25/2022 |
1.1.13 | 4,235 | 7/22/2022 |
1.1.12 | 4,240 | 7/19/2022 |
1.1.11 | 4,317 | 7/19/2022 |
1.1.10 | 4,289 | 7/19/2022 |
1.1.9 | 4,326 | 7/19/2022 |
1.1.8 | 4,387 | 7/18/2022 |
1.1.7 | 4,217 | 7/18/2022 |
1.1.6 | 4,311 | 7/18/2022 |
1.1.5 | 4,305 | 7/17/2022 |
1.1.4 | 1,660 | 7/17/2022 |
1.1.3 | 6,825 | 7/17/2022 |
1.1.2 | 4,359 | 7/17/2022 |
1.1.1 | 1,692 | 7/17/2022 |
1.1.0 | 4,296 | 7/17/2022 |
1.0.2 | 4,302 | 7/15/2022 |
1.0.1 | 2,986 | 7/15/2022 |
1.0.0 | 5,500 | 7/8/2022 |
0.10.7 | 4,317 | 7/7/2022 |
0.10.6 | 1,753 | 7/7/2022 |
0.10.3 | 2,204 | 7/7/2022 |
0.10.2 | 5,750 | 7/2/2022 |
0.10.1 | 4,314 | 7/1/2022 |
0.10.0 | 4,107 | 7/1/2022 |
0.9.10 | 5,410 | 6/20/2022 |
0.9.9 | 4,367 | 6/11/2022 |
0.9.8 | 1,676 | 6/10/2022 |
0.9.7 | 4,244 | 6/9/2022 |
0.9.6 | 4,233 | 6/5/2022 |
0.9.5 | 2,850 | 6/3/2022 |
0.9.3 | 4,142 | 6/3/2022 |
0.9.2 | 2,461 | 5/31/2022 |
0.9.1 | 2,416 | 5/31/2022 |
0.9.0 | 2,402 | 5/31/2022 |
0.8.3-beta.1 | 113 | 5/31/2022 |
0.8.2 | 1,722 | 5/30/2022 |
0.8.1 | 1,730 | 5/29/2022 |