TheOmenDen.Shared.Interfaces
2.12.1.48
Prefix Reserved
dotnet add package TheOmenDen.Shared.Interfaces --version 2.12.1.48
NuGet\Install-Package TheOmenDen.Shared.Interfaces -Version 2.12.1.48
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="TheOmenDen.Shared.Interfaces" Version="2.12.1.48" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TheOmenDen.Shared.Interfaces --version 2.12.1.48
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TheOmenDen.Shared.Interfaces, 2.12.1.48"
#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.
// Install TheOmenDen.Shared.Interfaces as a Cake Addin #addin nuget:?package=TheOmenDen.Shared.Interfaces&version=2.12.1.48 // Install TheOmenDen.Shared.Interfaces as a Cake Tool #tool nuget:?package=TheOmenDen.Shared.Interfaces&version=2.12.1.48
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TheOmenDen Shared Interfaces
A collection of interfaces present in The Omen Den's applications
Below are descriptions to the best of my ability for what each section in the namespaces defines.
1. Accessors
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
2. Repositories
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
3. Services
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.
ToDos
- 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
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 is compatible. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- TheOmenDen.Shared (>= 2023.11.27.49)
-
net7.0
- TheOmenDen.Shared (>= 2023.11.27.49)
-
net8.0
- TheOmenDen.Shared (>= 2023.11.27.49)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TheOmenDen.Shared.Interfaces:
Package | Downloads |
---|---|
TheOmenDen.Shared.Services
A collection of the service implementations used throughout the various apps that The Omen Den develops. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.12.1.48 | 201 | 12/1/2023 |
2.3.20.1734 | 1,632 | 3/20/2023 |
1.11.13.2216 | 473 | 11/14/2022 |
1.10.8.106 | 2,255 | 10/8/2022 |
1.8.27.428 | 889 | 8/27/2022 |
1.7.26.1301 | 734 | 7/26/2022 |
Provides the basis for interfaces for various purposes