Table of Contents

Interface IQueryLayerComposer

Namespace
JsonApiDotNetCore.Queries
Assembly
JsonApiDotNetCore.dll

Takes scoped expressions from IQueryConstraintProviders and transforms them.

public interface IQueryLayerComposer

Methods

ComposeForGetById<TId>(TId, ResourceType, TopFieldSelection)

Collects constraints and builds a QueryLayer out of them, used to retrieve one resource.

QueryLayer ComposeForGetById<TId>(TId id, ResourceType primaryResourceType, TopFieldSelection fieldSelection)

Parameters

id TId
primaryResourceType ResourceType
fieldSelection TopFieldSelection

Returns

QueryLayer

Type Parameters

TId

ComposeForGetRelationshipRightIds(RelationshipAttribute, ICollection<IIdentifiable>)

Builds a query for the specified relationship with a filter to match on its right resource IDs.

QueryLayer ComposeForGetRelationshipRightIds(RelationshipAttribute relationship, ICollection<IIdentifiable> rightResourceIds)

Parameters

relationship RelationshipAttribute
rightResourceIds ICollection<IIdentifiable>

Returns

QueryLayer

ComposeForGetTargetedSecondaryResourceIds(IIdentifiable)

Builds a query for each targeted relationship with a filter to match on its right resource IDs.

IEnumerable<(QueryLayer, RelationshipAttribute)> ComposeForGetTargetedSecondaryResourceIds(IIdentifiable primaryResource)

Parameters

primaryResource IIdentifiable

Returns

IEnumerable<(QueryLayer, RelationshipAttribute)>

ComposeForHasMany<TId>(HasManyAttribute, TId, ICollection<IIdentifiable>)

Builds a query for a to-many relationship with a filter to match on its left and right resource IDs.

QueryLayer ComposeForHasMany<TId>(HasManyAttribute hasManyRelationship, TId leftId, ICollection<IIdentifiable> rightResourceIds)

Parameters

hasManyRelationship HasManyAttribute
leftId TId
rightResourceIds ICollection<IIdentifiable>

Returns

QueryLayer

Type Parameters

TId

ComposeForUpdate<TId>(TId, ResourceType)

Builds a query that retrieves the primary resource, including all of its attributes and all targeted relationships, during a create/update/delete request.

QueryLayer ComposeForUpdate<TId>(TId id, ResourceType primaryResourceType)

Parameters

id TId
primaryResourceType ResourceType

Returns

QueryLayer

Type Parameters

TId

ComposeFromConstraints(ResourceType)

Collects constraints and builds a QueryLayer out of them, used to retrieve the actual resources.

QueryLayer ComposeFromConstraints(ResourceType requestResourceType)

Parameters

requestResourceType ResourceType

Returns

QueryLayer

ComposeSecondaryLayerForRelationship(ResourceType)

Collects constraints and builds the secondary layer for a relationship endpoint.

QueryLayer ComposeSecondaryLayerForRelationship(ResourceType secondaryResourceType)

Parameters

secondaryResourceType ResourceType

Returns

QueryLayer

GetPrimaryFilterFromConstraints(ResourceType)

Builds a filter from constraints, used to determine total resource count on a primary collection endpoint.

FilterExpression? GetPrimaryFilterFromConstraints(ResourceType primaryResourceType)

Parameters

primaryResourceType ResourceType

Returns

FilterExpression

GetSecondaryFilterFromConstraints<TId>(TId, HasManyAttribute)

Builds a filter from constraints, used to determine total resource count on a secondary collection endpoint.

FilterExpression? GetSecondaryFilterFromConstraints<TId>(TId primaryId, HasManyAttribute hasManyRelationship)

Parameters

primaryId TId
hasManyRelationship HasManyAttribute

Returns

FilterExpression

Type Parameters

TId

WrapLayerForSecondaryEndpoint<TId>(QueryLayer, ResourceType, TId, RelationshipAttribute)

Wraps a layer for a secondary endpoint into a primary layer, rewriting top-level includes.

QueryLayer WrapLayerForSecondaryEndpoint<TId>(QueryLayer secondaryLayer, ResourceType primaryResourceType, TId primaryId, RelationshipAttribute relationship)

Parameters

secondaryLayer QueryLayer
primaryResourceType ResourceType
primaryId TId
relationship RelationshipAttribute

Returns

QueryLayer

Type Parameters

TId