Class ResourceDefinitionAccessor
- Namespace
- JsonApiDotNetCore.Resources
- Assembly
- JsonApiDotNetCore.dll
Retrieves an IResourceDefinition<TResource, TId> instance from the D/I container and invokes a callback on it.
[PublicAPI]
public class ResourceDefinitionAccessor : IResourceDefinitionAccessor
- Inheritance
-
ResourceDefinitionAccessor
- Implements
- Inherited Members
Constructors
ResourceDefinitionAccessor(IResourceGraph, IServiceProvider)
public ResourceDefinitionAccessor(IResourceGraph resourceGraph, IServiceProvider serviceProvider)
Parameters
resourceGraph
IResourceGraphserviceProvider
IServiceProvider
Properties
IsReadOnlyRequest
Indicates whether this request targets only fetching of data (resources and relationships), as opposed to applying changes.
[Obsolete("Use IJsonApiRequest.IsReadOnly.")]
public bool IsReadOnlyRequest { get; }
Property Value
Remarks
This property was added to reduce the impact of taking a breaking change. It will likely be removed in the next major version.
QueryableBuilder
Gets an IQueryableBuilder instance from the service container.
[Obsolete("Use injected IQueryableBuilder instead.")]
public IQueryableBuilder QueryableBuilder { get; }
Property Value
Remarks
This property was added to reduce the impact of taking a breaking change. It will likely be removed in the next major version.
Methods
GetMeta(ResourceType, IIdentifiable)
Invokes GetMeta(TResource) for the specified resource.
public IDictionary<string, object?>? GetMeta(ResourceType resourceType, IIdentifiable resourceInstance)
Parameters
resourceType
ResourceTyperesourceInstance
IIdentifiable
Returns
GetQueryableHandlerForQueryStringParameter(Type, string)
Invokes OnRegisterQueryableHandlersForQueryStringParameters() for the specified resource type, then returns the IQueryable<T> expression for the specified parameter name.
public object? GetQueryableHandlerForQueryStringParameter(Type resourceClrType, string parameterName)
Parameters
Returns
OnAddToRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken)
Invokes OnAddToRelationshipAsync(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken) for the specified resource.
public Task OnAddToRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcehasManyRelationship
HasManyAttributerightResourceIds
ISet<IIdentifiable>cancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnApplyFilter(ResourceType, FilterExpression?)
Invokes OnApplyFilter(FilterExpression?) for the specified resource type.
public FilterExpression? OnApplyFilter(ResourceType resourceType, FilterExpression? existingFilter)
Parameters
resourceType
ResourceTypeexistingFilter
FilterExpression
Returns
OnApplyIncludes(ResourceType, IImmutableSet<IncludeElementExpression>)
Invokes OnApplyIncludes(IImmutableSet<IncludeElementExpression>) for the specified resource type.
public IImmutableSet<IncludeElementExpression> OnApplyIncludes(ResourceType resourceType, IImmutableSet<IncludeElementExpression> existingIncludes)
Parameters
resourceType
ResourceTypeexistingIncludes
IImmutableSet<IncludeElementExpression>
Returns
OnApplyPagination(ResourceType, PaginationExpression?)
Invokes OnApplyPagination(PaginationExpression?) for the specified resource type.
public PaginationExpression? OnApplyPagination(ResourceType resourceType, PaginationExpression? existingPagination)
Parameters
resourceType
ResourceTypeexistingPagination
PaginationExpression
Returns
OnApplySort(ResourceType, SortExpression?)
Invokes OnApplySort(SortExpression?) for the specified resource type.
public SortExpression? OnApplySort(ResourceType resourceType, SortExpression? existingSort)
Parameters
resourceType
ResourceTypeexistingSort
SortExpression
Returns
OnApplySparseFieldSet(ResourceType, SparseFieldSetExpression?)
Invokes OnApplySparseFieldSet(SparseFieldSetExpression?) for the specified resource type.
public SparseFieldSetExpression? OnApplySparseFieldSet(ResourceType resourceType, SparseFieldSetExpression? existingSparseFieldSet)
Parameters
resourceType
ResourceTypeexistingSparseFieldSet
SparseFieldSetExpression
Returns
OnDeserialize(IIdentifiable)
Invokes OnDeserialize(TResource) for the specified resource.
public void OnDeserialize(IIdentifiable resource)
Parameters
resource
IIdentifiable
OnPrepareWriteAsync<TResource>(TResource, WriteOperationKind, CancellationToken)
Invokes OnPrepareWriteAsync(TResource, WriteOperationKind, CancellationToken) for the specified resource.
public Task OnPrepareWriteAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
resource
TResourcewriteOperation
WriteOperationKindcancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnRemoveFromRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken)
Invokes OnRemoveFromRelationshipAsync(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken) for the specified resource.
public Task OnRemoveFromRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcehasManyRelationship
HasManyAttributerightResourceIds
ISet<IIdentifiable>cancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnSerialize(IIdentifiable)
Invokes OnSerialize(TResource) for the specified resource.
public void OnSerialize(IIdentifiable resource)
Parameters
resource
IIdentifiable
OnSetToManyRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, WriteOperationKind, CancellationToken)
Invokes OnSetToManyRelationshipAsync(TResource, HasManyAttribute, ISet<IIdentifiable>, WriteOperationKind, CancellationToken) for the specified resource.
public Task OnSetToManyRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcehasManyRelationship
HasManyAttributerightResourceIds
ISet<IIdentifiable>writeOperation
WriteOperationKindcancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnSetToOneRelationshipAsync<TResource>(TResource, HasOneAttribute, IIdentifiable?, WriteOperationKind, CancellationToken)
Invokes OnSetToOneRelationshipAsync(TResource, HasOneAttribute, IIdentifiable?, WriteOperationKind, CancellationToken) for the specified resource.
public Task<IIdentifiable?> OnSetToOneRelationshipAsync<TResource>(TResource leftResource, HasOneAttribute hasOneRelationship, IIdentifiable? rightResourceId, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
leftResource
TResourcehasOneRelationship
HasOneAttributerightResourceId
IIdentifiablewriteOperation
WriteOperationKindcancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnWriteSucceededAsync<TResource>(TResource, WriteOperationKind, CancellationToken)
Invokes OnWriteSucceededAsync(TResource, WriteOperationKind, CancellationToken) for the specified resource.
public Task OnWriteSucceededAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
resource
TResourcewriteOperation
WriteOperationKindcancellationToken
CancellationToken
Returns
Type Parameters
TResource
OnWritingAsync<TResource>(TResource, WriteOperationKind, CancellationToken)
Invokes OnWritingAsync(TResource, WriteOperationKind, CancellationToken) for the specified resource.
public Task OnWritingAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable
Parameters
resource
TResourcewriteOperation
WriteOperationKindcancellationToken
CancellationToken
Returns
Type Parameters
TResource
ResolveResourceDefinition(ResourceType)
protected virtual object ResolveResourceDefinition(ResourceType resourceType)
Parameters
resourceType
ResourceType
Returns
ResolveResourceDefinition(Type)
protected object ResolveResourceDefinition(Type resourceClrType)
Parameters
resourceClrType
Type