Table of Contents

Interface IResourceDefinitionAccessor

Namespace
JsonApiDotNetCore.Resources
Assembly
JsonApiDotNetCore.dll

Retrieves an IResourceDefinition<TResource, TId> instance from the D/I container and invokes a callback on it.

public interface IResourceDefinitionAccessor

Properties

IsReadOnlyRequest

Indicates whether this request targets only fetching of data (resources and relationships), as opposed to applying changes.

[Obsolete("Use IJsonApiRequest.IsReadOnly.")]
bool IsReadOnlyRequest { get; }

Property Value

bool

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.")]
IQueryableBuilder QueryableBuilder { get; }

Property Value

IQueryableBuilder

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.

IDictionary<string, object?>? GetMeta(ResourceType resourceType, IIdentifiable resourceInstance)

Parameters

resourceType ResourceType
resourceInstance IIdentifiable

Returns

IDictionary<string, object>

GetQueryableHandlerForQueryStringParameter(Type, string)

Invokes OnRegisterQueryableHandlersForQueryStringParameters() for the specified resource type, then returns the IQueryable<T> expression for the specified parameter name.

object? GetQueryableHandlerForQueryStringParameter(Type resourceClrType, string parameterName)

Parameters

resourceClrType Type
parameterName string

Returns

object

OnAddToRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken)

Task OnAddToRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

leftResource TResource
hasManyRelationship HasManyAttribute
rightResourceIds ISet<IIdentifiable>
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource

OnApplyFilter(ResourceType, FilterExpression?)

Invokes OnApplyFilter(FilterExpression?) for the specified resource type.

FilterExpression? OnApplyFilter(ResourceType resourceType, FilterExpression? existingFilter)

Parameters

resourceType ResourceType
existingFilter FilterExpression

Returns

FilterExpression

OnApplyIncludes(ResourceType, IImmutableSet<IncludeElementExpression>)

Invokes OnApplyIncludes(IImmutableSet<IncludeElementExpression>) for the specified resource type.

IImmutableSet<IncludeElementExpression> OnApplyIncludes(ResourceType resourceType, IImmutableSet<IncludeElementExpression> existingIncludes)

Parameters

resourceType ResourceType
existingIncludes IImmutableSet<IncludeElementExpression>

Returns

IImmutableSet<IncludeElementExpression>

OnApplyPagination(ResourceType, PaginationExpression?)

Invokes OnApplyPagination(PaginationExpression?) for the specified resource type.

PaginationExpression? OnApplyPagination(ResourceType resourceType, PaginationExpression? existingPagination)

Parameters

resourceType ResourceType
existingPagination PaginationExpression

Returns

PaginationExpression

OnApplySort(ResourceType, SortExpression?)

Invokes OnApplySort(SortExpression?) for the specified resource type.

SortExpression? OnApplySort(ResourceType resourceType, SortExpression? existingSort)

Parameters

resourceType ResourceType
existingSort SortExpression

Returns

SortExpression

OnApplySparseFieldSet(ResourceType, SparseFieldSetExpression?)

Invokes OnApplySparseFieldSet(SparseFieldSetExpression?) for the specified resource type.

SparseFieldSetExpression? OnApplySparseFieldSet(ResourceType resourceType, SparseFieldSetExpression? existingSparseFieldSet)

Parameters

resourceType ResourceType
existingSparseFieldSet SparseFieldSetExpression

Returns

SparseFieldSetExpression

OnDeserialize(IIdentifiable)

Invokes OnDeserialize(TResource) for the specified resource.

void OnDeserialize(IIdentifiable resource)

Parameters

resource IIdentifiable

OnPrepareWriteAsync<TResource>(TResource, WriteOperationKind, CancellationToken)

Task OnPrepareWriteAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

resource TResource
writeOperation WriteOperationKind
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource

OnRemoveFromRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, CancellationToken)

Task OnRemoveFromRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

leftResource TResource
hasManyRelationship HasManyAttribute
rightResourceIds ISet<IIdentifiable>
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource

OnSerialize(IIdentifiable)

Invokes OnSerialize(TResource) for the specified resource.

void OnSerialize(IIdentifiable resource)

Parameters

resource IIdentifiable

OnSetToManyRelationshipAsync<TResource>(TResource, HasManyAttribute, ISet<IIdentifiable>, WriteOperationKind, CancellationToken)

Task OnSetToManyRelationshipAsync<TResource>(TResource leftResource, HasManyAttribute hasManyRelationship, ISet<IIdentifiable> rightResourceIds, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

leftResource TResource
hasManyRelationship HasManyAttribute
rightResourceIds ISet<IIdentifiable>
writeOperation WriteOperationKind
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource

OnSetToOneRelationshipAsync<TResource>(TResource, HasOneAttribute, IIdentifiable?, WriteOperationKind, CancellationToken)

Task<IIdentifiable?> OnSetToOneRelationshipAsync<TResource>(TResource leftResource, HasOneAttribute hasOneRelationship, IIdentifiable? rightResourceId, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

leftResource TResource
hasOneRelationship HasOneAttribute
rightResourceId IIdentifiable
writeOperation WriteOperationKind
cancellationToken CancellationToken

Returns

Task<IIdentifiable>

Type Parameters

TResource

OnWriteSucceededAsync<TResource>(TResource, WriteOperationKind, CancellationToken)

Task OnWriteSucceededAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

resource TResource
writeOperation WriteOperationKind
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource

OnWritingAsync<TResource>(TResource, WriteOperationKind, CancellationToken)

Task OnWritingAsync<TResource>(TResource resource, WriteOperationKind writeOperation, CancellationToken cancellationToken) where TResource : class, IIdentifiable

Parameters

resource TResource
writeOperation WriteOperationKind
cancellationToken CancellationToken

Returns

Task

Type Parameters

TResource