Interface IResourceWriteRepository<TResource, TId>
- Namespace
- JsonApiDotNetCore.Repositories
- Assembly
- JsonApiDotNetCore.dll
Groups write operations.
[PublicAPI]
public interface IResourceWriteRepository<TResource, in TId> where TResource : class, IIdentifiable<in TId>
Type Parameters
TResourceThe resource type.
TIdThe resource identifier type.
Methods
AddToToManyRelationshipAsync(TResource?, TId, ISet<IIdentifiable>, CancellationToken)
Adds resources to a to-many relationship in the underlying data store.
Task AddToToManyRelationshipAsync(TResource? leftResource, TId leftId, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken)
Parameters
leftResourceTResourceleftIdTIdrightResourceIdsISet<IIdentifiable>cancellationTokenCancellationToken
Returns
CreateAsync(TResource, TResource, CancellationToken)
Creates a new resource in the underlying data store.
Task CreateAsync(TResource resourceFromRequest, TResource resourceForDatabase, CancellationToken cancellationToken)
Parameters
resourceFromRequestTResourceresourceForDatabaseTResourcecancellationTokenCancellationToken
Returns
DeleteAsync(TResource?, TId, CancellationToken)
Deletes an existing resource from the underlying data store.
Task DeleteAsync(TResource? resourceFromDatabase, TId id, CancellationToken cancellationToken)
Parameters
resourceFromDatabaseTResourceidTIdcancellationTokenCancellationToken
Returns
GetForCreateAsync(Type, TId, CancellationToken)
Creates a new resource instance, in preparation for CreateAsync(TResource, TResource, CancellationToken).
Task<TResource> GetForCreateAsync(Type resourceClrType, TId id, CancellationToken cancellationToken)
Parameters
resourceClrTypeTypeidTIdcancellationTokenCancellationToken
Returns
- Task<TResource>
Remarks
This method can be overridden to assign resource-specific required relationships.
GetForUpdateAsync(QueryLayer, CancellationToken)
Retrieves a resource with all of its attributes, including the set of targeted relationships, in preparation for UpdateAsync(TResource, TResource, CancellationToken).
Task<TResource?> GetForUpdateAsync(QueryLayer queryLayer, CancellationToken cancellationToken)
Parameters
queryLayerQueryLayercancellationTokenCancellationToken
Returns
- Task<TResource>
RemoveFromToManyRelationshipAsync(TResource, ISet<IIdentifiable>, CancellationToken)
Removes resources from a to-many relationship in the underlying data store.
Task RemoveFromToManyRelationshipAsync(TResource leftResource, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken)
Parameters
leftResourceTResourcerightResourceIdsISet<IIdentifiable>cancellationTokenCancellationToken
Returns
SetRelationshipAsync(TResource, object?, CancellationToken)
Performs a complete replacement of the relationship in the underlying data store.
Task SetRelationshipAsync(TResource leftResource, object? rightValue, CancellationToken cancellationToken)
Parameters
leftResourceTResourcerightValueobjectcancellationTokenCancellationToken
Returns
UpdateAsync(TResource, TResource, CancellationToken)
Updates the attributes and relationships of an existing resource in the underlying data store.
Task UpdateAsync(TResource resourceFromRequest, TResource resourceFromDatabase, CancellationToken cancellationToken)
Parameters
resourceFromRequestTResourceresourceFromDatabaseTResourcecancellationTokenCancellationToken