Serialization Support for Delta Feed
This sample will introduce how to create a Delta Feed which is serialized into a Delta Response in Web API OData V4.
Similar to EdmEntityObjectCollection
, Web API OData V5.6 now has an EdmChangedObjectCollection
to represent a collection of objects which can be a part of the Delta Feed.
A delta response can contain new/changed entities, deleted entities, new links or deleted links.
WebAPI OData V4 now has EdmDeltaEntityObject
, EdmDeltaDeletedEntityObject
, EdmDeltaLink
and EdmDeltaDeletedLink
respectively for the objects that can be a part of the Delta response.
All the above objects implement the IEdmChangedObject
interface, while the EdmChangedObjectCollection
is a collection of IEdmChangedObject
.
For example, if user defines a model as:
The EdmChangedObjectCollection
collection for Customer entity will be created as follows:
Changed or Modified objects are added as EdmDeltaEntityObject
s:
Deleted objects are added as EdmDeltaDeletedObject
s:
Delta Link is added corresponding to a $expand in the initial request, these are added as EdmDeltaLink
s:
Deleted Links is added for each deleted link that corresponds to a $expand path in the initial request, these are added as EdmDeltaDeletedLink
s:
Sample for Delta Feed
Let’s create a controller to return a Delta Feed:
Now, user can issue a GET request as:
The corresponding payload will has the following contents: