Interface ISparseFieldSetCache
- Namespace
- JsonApiDotNetCore.Queries
- Assembly
- JsonApiDotNetCore.dll
Takes sparse fieldsets from IQueryConstraintProviders and invokes OnApplySparseFieldSet(SparseFieldSetExpression?) on them.
public interface ISparseFieldSetCache
Remarks
This cache ensures that for each request (or operation per request), the resource definition callback is executed only twice per resource type. The first invocation is used to obtain the fields to retrieve from the underlying data store, while the second invocation is used to determine which fields to write to the response body.
Methods
GetIdAttributeSetForRelationshipQuery(ResourceType)
Gets the set of attributes to retrieve from the underlying data store for relationship endpoints. This always returns 'id', along with any additional attributes from resource definition callback.
IImmutableSet<AttrAttribute> GetIdAttributeSetForRelationshipQuery(ResourceType resourceType)
Parameters
resourceType
ResourceType
Returns
GetSparseFieldSetForQuery(ResourceType)
Gets the set of sparse fields to retrieve from the underlying data store. Returns an empty set to retrieve all fields.
IImmutableSet<ResourceFieldAttribute> GetSparseFieldSetForQuery(ResourceType resourceType)
Parameters
resourceType
ResourceType
Returns
GetSparseFieldSetForSerializer(ResourceType)
Gets the evaluated set of sparse fields to serialize into the response body.
IImmutableSet<ResourceFieldAttribute> GetSparseFieldSetForSerializer(ResourceType resourceType)
Parameters
resourceType
ResourceType
Returns
Reset()
Resets the cached results from resource definition callbacks.
void Reset()