Rystem.RepositoryFramework.Api.Abstractions
0.9.2
dotnet add package Rystem.RepositoryFramework.Api.Abstractions --version 0.9.2
NuGet\Install-Package Rystem.RepositoryFramework.Api.Abstractions -Version 0.9.2
<PackageReference Include="Rystem.RepositoryFramework.Api.Abstractions" Version="0.9.2" />
paket add Rystem.RepositoryFramework.Api.Abstractions --version 0.9.2
#r "nuget: Rystem.RepositoryFramework.Api.Abstractions, 0.9.2"
// Install Rystem.RepositoryFramework.Api.Abstractions as a Cake Addin #addin nuget:?package=Rystem.RepositoryFramework.Api.Abstractions&version=0.9.2 // Install Rystem.RepositoryFramework.Api.Abstractions as a Cake Tool #tool nuget:?package=Rystem.RepositoryFramework.Api.Abstractions&version=0.9.2
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 ICommandClient<T, TKey> : ICommand<T, TKey>, ICommandPattern
where TKey : notnull
{
}
based on
public interface ICommand<T, TKey> : 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 IQueryClient<T, TKey> : IQuery<T, TKey>, IQueryPattern
where TKey : notnull
{
}
based on
public interface IQuery<T, TKey> : IQueryPattern
where TKey : notnull
{
Task<T?> GetAsync(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 IRepositoryClient<T, TKey> : IRepository<T, TKey>, ICommand<T, TKey>, IQuery<T, TKey>, IRepositoryPattern, ICommandPattern, IQueryPattern
where TKey : notnull
{
}
based on
public interface IRepository<T, TKey> : ICommand<T, TKey>, IQuery<T, TKey>, IRepositoryPattern, ICommandPattern, IQueryPattern
where TKey : notnull
{
}
Interceptors
You may add an interceptor for your http client, before each request through the http client you can do some tasks, for example extending this interface is the best way to enrich the request with a JWT token for authorization purpose.
public interface IRepositoryClientInterceptor
{
Task<HttpClient> EnrichAsync(HttpClient client, ApiName path);
}
or the more specific (for Model)
public interface IRepositoryClientInterceptor<T, TKey> : IRepositoryClientInterceptor
where TKey : notnull
{
}
or the more specific and with object type (default) as key
public interface IRepositoryClientInterceptor<T> : IRepositoryClientInterceptor
{
}
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
- Rystem.RepositoryFramework.Abstractions (>= 0.9.2)
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 |
---|