Class ResourceChangeTracker<TResource>
- Namespace
- JsonApiDotNetCore.Resources
- Assembly
- JsonApiDotNetCore.dll
Used to determine whether additional changes to a resource (side effects), not specified in a POST or PATCH request, have been applied.
[PublicAPI]
public sealed class ResourceChangeTracker<TResource> : IResourceChangeTracker<TResource> where TResource : class, IIdentifiable
Type Parameters
TResource
The resource type.
- Inheritance
-
ResourceChangeTracker<TResource>
- Implements
-
IResourceChangeTracker<TResource>
- Inherited Members
Constructors
ResourceChangeTracker(IJsonApiRequest, ITargetedFields)
public ResourceChangeTracker(IJsonApiRequest request, ITargetedFields targetedFields)
Parameters
request
IJsonApiRequesttargetedFields
ITargetedFields
Methods
HasImplicitChanges()
Validates if any exposed resource attributes that were not in the POST or PATCH request have been changed. And validates if the values from the request are stored without modification.
public bool HasImplicitChanges()
Returns
- bool
true
if the attribute values from the POST or PATCH request were the only changes;false
, otherwise.
SetFinallyStoredAttributeValues(TResource)
Sets the exposed resource attributes as stored in database, after applying the POST or PATCH operation.
public void SetFinallyStoredAttributeValues(TResource resource)
Parameters
resource
TResource
SetInitiallyStoredAttributeValues(TResource)
Sets the exposed resource attributes as stored in database, before applying the PATCH operation. For POST operations, this sets exposed resource attributes to their default value.
public void SetInitiallyStoredAttributeValues(TResource resource)
Parameters
resource
TResource
SetRequestAttributeValues(TResource)
Sets the (subset of) exposed resource attributes from the POST or PATCH request.
public void SetRequestAttributeValues(TResource resource)
Parameters
resource
TResource