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
resourceGraphIResourceGraphserviceProviderIServiceProvider
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
resourceTypeResourceTyperesourceInstanceIIdentifiable
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
leftResourceTResourcehasManyRelationshipHasManyAttributerightResourceIdsISet<IIdentifiable>cancellationTokenCancellationToken
Returns
Type Parameters
TResource
OnApplyFilter(ResourceType, FilterExpression?)
Invokes OnApplyFilter(FilterExpression?) for the specified resource type.
public FilterExpression? OnApplyFilter(ResourceType resourceType, FilterExpression? existingFilter)
Parameters
resourceTypeResourceTypeexistingFilterFilterExpression
Returns
OnApplyIncludes(ResourceType, IImmutableSet<IncludeElementExpression>)
Invokes OnApplyIncludes(IImmutableSet<IncludeElementExpression>) for the specified resource type.
public IImmutableSet<IncludeElementExpression> OnApplyIncludes(ResourceType resourceType, IImmutableSet<IncludeElementExpression> existingIncludes)
Parameters
resourceTypeResourceTypeexistingIncludesIImmutableSet<IncludeElementExpression>
Returns
OnApplyPagination(ResourceType, PaginationExpression?)
Invokes OnApplyPagination(PaginationExpression?) for the specified resource type.
public PaginationExpression? OnApplyPagination(ResourceType resourceType, PaginationExpression? existingPagination)
Parameters
resourceTypeResourceTypeexistingPaginationPaginationExpression
Returns
OnApplySort(ResourceType, SortExpression?)
Invokes OnApplySort(SortExpression?) for the specified resource type.
public SortExpression? OnApplySort(ResourceType resourceType, SortExpression? existingSort)
Parameters
resourceTypeResourceTypeexistingSortSortExpression
Returns
OnApplySparseFieldSet(ResourceType, SparseFieldSetExpression?)
Invokes OnApplySparseFieldSet(SparseFieldSetExpression?) for the specified resource type.
public SparseFieldSetExpression? OnApplySparseFieldSet(ResourceType resourceType, SparseFieldSetExpression? existingSparseFieldSet)
Parameters
resourceTypeResourceTypeexistingSparseFieldSetSparseFieldSetExpression
Returns
OnDeserialize(IIdentifiable)
Invokes OnDeserialize(TResource) for the specified resource.
public void OnDeserialize(IIdentifiable resource)
Parameters
resourceIIdentifiable
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
resourceTResourcewriteOperationWriteOperationKindcancellationTokenCancellationToken
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
leftResourceTResourcehasManyRelationshipHasManyAttributerightResourceIdsISet<IIdentifiable>cancellationTokenCancellationToken
Returns
Type Parameters
TResource
OnSerialize(IIdentifiable)
Invokes OnSerialize(TResource) for the specified resource.
public void OnSerialize(IIdentifiable resource)
Parameters
resourceIIdentifiable
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
leftResourceTResourcehasManyRelationshipHasManyAttributerightResourceIdsISet<IIdentifiable>writeOperationWriteOperationKindcancellationTokenCancellationToken
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
leftResourceTResourcehasOneRelationshipHasOneAttributerightResourceIdIIdentifiablewriteOperationWriteOperationKindcancellationTokenCancellationToken
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
resourceTResourcewriteOperationWriteOperationKindcancellationTokenCancellationToken
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
resourceTResourcewriteOperationWriteOperationKindcancellationTokenCancellationToken
Returns
Type Parameters
TResource
ResolveResourceDefinition(ResourceType)
protected virtual object ResolveResourceDefinition(ResourceType resourceType)
Parameters
resourceTypeResourceType
Returns
ResolveResourceDefinition(Type)
protected object ResolveResourceDefinition(Type resourceClrType)
Parameters
resourceClrTypeType