IAccessor
- Allows for simple access to read only methods defined across an entity.
- Works for Database entities, and other areas where you need to limit to read only methods.
IAsyncStreamAccessor
- ALlows for asynchronous streaming access to read only methods defined across an entity.
- Allows for
await foreach
by way of returning anIAsyncEnumerable
.
IKeyedAccessor
- Allows for a bit more complicated access to read only methods defined across an entity.
- Working with
IEntityKey
as the prevealent key to allow for searching across conditions. - Methods defined here return a
Tuple
combination of the Result and the corresponding entities retrieved.- The result specified is a boolean indicating whether the underlying operation was successful
True
on success, otherwiseFalse
. - This is to hopefully guide the implementation away from throwing an exception when the operation is unsuccessful.
- The result specified is a boolean indicating whether the underlying operation was successful
IKeyedAsyncStreamAccessor
- Similar to the
IKeyedAccessor
but returns only theIAsyncEnumerable
stream - Allows for streaming access to read only methods defined across an keyed entities, and returns matches for the provided key.
- Similar to the
IRepository
- A covariant interface that requires the implementation to also implement
IEnumerable
. - Defines methods for Adding/Creating, Updating, and Deleting entties with
CancellationToken
support on asynchronous methods. - This will allow for accessing the underlying methods of the repository with
System.Linq
as well asforeach
loops.
- A covariant interface that requires the implementation to also implement
IStreamingRepository
- A covariant interface that requires the implementation to also implement
IAsyncEnumerable
. - Defines methods for Adding/Creating, Updating, and Deleting entties with
CancellationToken
support on asynchronous methods. - This will allow for asynchronous streaming access of the underlying methods via
System.Linq.Async
as well asawait foreach
loops.
- A covariant interface that requires the implementation to also implement
IDataOperations
- A combination interface that contains the methods defined in both
IRepository
andIStreamingRepository
. - Defines methods for Adding/Creating, Updating, and Deleting entties with
CancellationToken
support on asynchronous methods. - This allows for a flexible approach to methods within the implementation to incorporate traditional methods, as well as asynchronous streaming.
- A combination interface that contains the methods defined in both
IKeyedDataOperations
- A combination interface that contains the methods defined in both
IRepository
andIStreamingRepository
.- To better distinguish between
IDataOperations
andIKeyedDataOperations
.- There's the additional constrained generic parameter
TKey
which requires that the key be provided during construction of an implementation, as well as be of typeIEntityKey
. - This is intentional since we should be approaching these methods with relative caution, and capture the intent, and rational for object manipulation.
- There's the additional constrained generic parameter
- To better distinguish between
- Defines methods for Adding/Creating, Updating, and Deleting entties with
CancellationToken
support on asynchronous methods. - A mjaor difference between this interface and
IDataOperations
is that the results of each method to implement requires a return value. ofTuple{TResult, TEntity}
TResult
is typically a boolean, but could signify any sort of indicator of the success or failure of the operation.- This was done to hopefully discourage exception throwing in the implementations and define a "peaceful" approach to handling failures.
- This approach does present a tighter coupling between the results of the operation and the Entity(or entities) returned.
- A combination interface that contains the methods defined in both
IApiService
andIApiService<T>
IApiService
is an empty interface.- This was done for ease of implementation when it came to dependency injection in implementations with
Scrutor
.
- This was done for ease of implementation when it came to dependency injection in implementations with
IApiService<T>
contains CRUD methods that can be used to retrieve and alter information via an external API.- CRUD methods are defined to
GET
,POST
,PUT
,DELETE
and all provideCancellationToken
support.
- CRUD methods are defined to
IStreamingApiService
andIStreamingApiService<T>
IStreamingApiService
is an empty interface.- This was done for ease of implementation when it came to dependency injection in implementations with
Scrutor
.
- This was done for ease of implementation when it came to dependency injection in implementations with
IstreamingApiService<T>
- Defines two different methods of retrieving results from an external API. These methods do allow forCancellationToken
support.StreamApiResultsAsync
- Returns anIASyncEnumerable<ApiResponse>
.ApiResponse
- from TheOmenDen.Shared project.- This was done to allow for failure of individual objects contained in the response body, while still allowing for streaming of the results.
- Enumerate with
await foreach
EnumerateApiResultsAsync
- Returns aTask<ApiResponse<IEnumerable<T>>>
- This will retrieve the results from the api whiel the header content is read, and before the entire result set is read.
- This was done to provide an easy implementation and encourage the use of the
System.Text.Json JsonSerializer
's ability to read through streams.
- Define more constructive interfaces
- Refine the use cases of currently defined interfaces
- Improve the functionality and performance of interfaces
- Provide ways for source generators to be used