You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current serialization architecture in OData libraries
Our libraries currently use what I would call a "push" based serialization model, where the higher-level components push the data that they want written down to the lower-level components. The lower-level part of the serialization happens in the Microsoft.OData.Core library, higher level processes take place in Microsoft.AspNetCore.OData, Microsoft.OData.Client and/or the user's application.
The following diagram illustrates how data is serialized into JSON using OData libraries:
Let's say we have a web API based on Microsoft.AspNetCore.OData. The user application has a /People({id}) endpoint handled by an OData controller that returns an instance of type Person. The value returned by the controller will eventually find its way to an ODataResourceSerializer defined in Microsoft.AspNetCore.OData.
The ODataResourceSerializer will create an ODataResource object for this instance and populate it with properties and values from the Person instance taking into account the $select and $expand query options. The serializer might also add other metadata to the ODataResource, like annotations, navigation links, ETag, etc. Then it will pass the ODataResource to the ODataMessageWriter defined in Microsoft.OData.Core
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Current serialization architecture in OData libraries
Our libraries currently use what I would call a "push" based serialization model, where the higher-level components push the data that they want written down to the lower-level components. The lower-level part of the serialization happens in the
Microsoft.OData.Core
library, higher level processes take place inMicrosoft.AspNetCore.OData
,Microsoft.OData.Client
and/or the user's application.The following diagram illustrates how data is serialized into JSON using OData libraries:
Let's say we have a web API based on
Microsoft.AspNetCore.OData
. The user application has a/People({id})
endpoint handled by an OData controller that returns an instance of typePerson
. The value returned by the controller will eventually find its way to anODataResourceSerializer
defined inMicrosoft.AspNetCore.OData
.The
ODataResourceSerializer
will create anODataResource
object for this instance and populate it with properties and values from thePerson
instance taking into account the$select
and$expand
query options. The serializer might also add other metadata to theODataResource
, like annotations, navigation links, ETag, etc. Then it will pass theODataResource
to theODataMessageWriter
defined inMicrosoft.OData.Core
...
Beta Was this translation helpful? Give feedback.
All reactions