Class ResourceRepositoryAccessor
- Namespace
- JsonApiDotNetCore.Repositories
- Assembly
- JsonApiDotNetCore.dll
Retrieves an IResourceRepository<TResource, TId> instance from the D/I container and invokes a method on it.
[PublicAPI]
public class ResourceRepositoryAccessor : IResourceRepositoryAccessor
- Inheritance
-
ResourceRepositoryAccessor
- Implements
- Inherited Members
Constructors
ResourceRepositoryAccessor(IServiceProvider, IResourceGraph, IJsonApiRequest)
public ResourceRepositoryAccessor(IServiceProvider serviceProvider, IResourceGraph resourceGraph, IJsonApiRequest request)
Parameters
serviceProvider
IServiceProviderresourceGraph
IResourceGraphrequest
IJsonApiRequest
Methods
AddToToManyRelationshipAsync<TResource, TId>(TResource?, TId, ISet<IIdentifiable>, CancellationToken)
Invokes AddToToManyRelationshipAsync(TResource?, TId, ISet<IIdentifiable>, CancellationToken) for the specified resource type.
public Task AddToToManyRelationshipAsync<TResource, TId>(TResource? leftResource, TId leftId, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable<TId>
Parameters
leftResource
TResourceleftId
TIdrightResourceIds
ISet<IIdentifiable>cancellationToken
CancellationToken
Returns
Type Parameters
TResource
TId
CountAsync(ResourceType, FilterExpression?, CancellationToken)
Invokes CountAsync(FilterExpression?, CancellationToken) for the specified resource type.
public Task<int> CountAsync(ResourceType resourceType, FilterExpression? filter, CancellationToken cancellationToken)
Parameters
resourceType
ResourceTypefilter
FilterExpressioncancellationToken
CancellationToken
Returns
CreateAsync<TResource>(TResource, TResource, CancellationToken)
Invokes CreateAsync(TResource, TResource, CancellationToken) for the specified resource type.
public Task CreateAsync<TResource>(TResource resourceFromRequest, TResource resourceForDatabase, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
resourceFromRequest
TResourceresourceForDatabase
TResourcecancellationToken
CancellationToken
Returns
Type Parameters
TResource
DeleteAsync<TResource, TId>(TResource?, TId, CancellationToken)
Invokes DeleteAsync(TResource?, TId, CancellationToken) for the specified resource type.
public Task DeleteAsync<TResource, TId>(TResource? resourceFromDatabase, TId id, CancellationToken cancellationToken) where TResource : class, IIdentifiable<TId>
Parameters
resourceFromDatabase
TResourceid
TIdcancellationToken
CancellationToken
Returns
Type Parameters
TResource
TId
GetAsync(ResourceType, QueryLayer, CancellationToken)
Invokes GetAsync(QueryLayer, CancellationToken) for the specified resource type.
public Task<IReadOnlyCollection<IIdentifiable>> GetAsync(ResourceType resourceType, QueryLayer queryLayer, CancellationToken cancellationToken)
Parameters
resourceType
ResourceTypequeryLayer
QueryLayercancellationToken
CancellationToken
Returns
GetAsync<TResource>(QueryLayer, CancellationToken)
Invokes GetAsync(QueryLayer, CancellationToken) for the specified resource type.
public Task<IReadOnlyCollection<TResource>> GetAsync<TResource>(QueryLayer queryLayer, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
queryLayer
QueryLayercancellationToken
CancellationToken
Returns
- Task<IReadOnlyCollection<TResource>>
Type Parameters
TResource
GetForCreateAsync<TResource, TId>(Type, TId, CancellationToken)
Invokes GetForCreateAsync(Type, TId, CancellationToken) for the specified resource type.
public Task<TResource> GetForCreateAsync<TResource, TId>(Type resourceClrType, TId id, CancellationToken cancellationToken) where TResource : class, IIdentifiable<TId>
Parameters
resourceClrType
Typeid
TIdcancellationToken
CancellationToken
Returns
- Task<TResource>
Type Parameters
TResource
TId
GetForUpdateAsync<TResource>(QueryLayer, CancellationToken)
Invokes GetForUpdateAsync(QueryLayer, CancellationToken) for the specified resource type.
public Task<TResource?> GetForUpdateAsync<TResource>(QueryLayer queryLayer, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
queryLayer
QueryLayercancellationToken
CancellationToken
Returns
- Task<TResource>
Type Parameters
TResource
RemoveFromToManyRelationshipAsync<TResource>(TResource, ISet<IIdentifiable>, CancellationToken)
Invokes RemoveFromToManyRelationshipAsync(TResource, ISet<IIdentifiable>, CancellationToken) for the specified resource type.
public Task RemoveFromToManyRelationshipAsync<TResource>(TResource leftResource, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcerightResourceIds
ISet<IIdentifiable>cancellationToken
CancellationToken
Returns
Type Parameters
TResource
ResolveReadRepository(ResourceType)
protected virtual object ResolveReadRepository(ResourceType resourceType)
Parameters
resourceType
ResourceType
Returns
ResolveReadRepository(Type)
protected object ResolveReadRepository(Type resourceClrType)
Parameters
resourceClrType
Type
Returns
ResolveWriteRepository(Type)
protected virtual object ResolveWriteRepository(Type resourceClrType)
Parameters
resourceClrType
Type
Returns
SetRelationshipAsync<TResource>(TResource, object?, CancellationToken)
Invokes SetRelationshipAsync(TResource, object?, CancellationToken) for the specified resource type.
public Task SetRelationshipAsync<TResource>(TResource leftResource, object? rightValue, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcerightValue
objectcancellationToken
CancellationToken
Returns
Type Parameters
TResource
UpdateAsync<TResource>(TResource, TResource, CancellationToken)
Invokes UpdateAsync(TResource, TResource, CancellationToken) for the specified resource type.
public Task UpdateAsync<TResource>(TResource resourceFromRequest, TResource resourceFromDatabase, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
resourceFromRequest
TResourceresourceFromDatabase
TResourcecancellationToken
CancellationToken
Returns
Type Parameters
TResource