Class ODataCollectionSerializer
ODataSerializer for serializing collection of Entities or Complex types or primitives.
public class ODataCollectionSerializer : ODataEdmTypeSerializer
- Inheritance
-
ODataCollectionSerializer
- Inherited Members
Constructors
ODataCollectionSerializer(ODataSerializerProvider)
Initializes a new instance of the ODataCollectionSerializer class.
public ODataCollectionSerializer(ODataSerializerProvider serializerProvider)
Parameters
serializerProvider
ODataSerializerProviderThe serializer provider to use to serialize nested objects.
Methods
AddTypeNameAnnotationAsNeeded(ODataCollectionValue, ODataMetadataLevel)
Adds the type name annotations required for proper json light serialization.
protected static void AddTypeNameAnnotationAsNeeded(ODataCollectionValue value, ODataMetadataLevel metadataLevel)
Parameters
value
ODataCollectionValueThe collection value for which the annotations have to be added.
metadataLevel
ODataMetadataLevelThe OData metadata level of the response.
CreateODataCollectionValue(IEnumerable, IEdmTypeReference, ODataSerializerContext)
Creates an Microsoft.Data.OData.ODataCollectionValue for the enumerable represented by enumerable
.
public virtual ODataCollectionValue CreateODataCollectionValue(IEnumerable enumerable, IEdmTypeReference elementType, ODataSerializerContext writeContext)
Parameters
enumerable
IEnumerableThe value of the collection to be created.
elementType
IEdmTypeReferenceThe element EDM type of the collection.
writeContext
ODataSerializerContextThe serializer context to be used while creating the collection.
Returns
- ODataCollectionValue
The created Microsoft.Data.OData.ODataCollectionValue.
CreateODataValue(object, IEdmTypeReference, ODataSerializerContext)
public override sealed ODataValue CreateODataValue(object graph, IEdmTypeReference expectedType, ODataSerializerContext writeContext)
Parameters
graph
objectexpectedType
IEdmTypeReferencewriteContext
ODataSerializerContext
Returns
- ODataValue
WriteCollection(ODataCollectionWriter, object, IEdmTypeReference, ODataSerializerContext)
Writes the given graph
using the given writer
.
public void WriteCollection(ODataCollectionWriter writer, object graph, IEdmTypeReference collectionType, ODataSerializerContext writeContext)
Parameters
writer
ODataCollectionWriterThe Microsoft.Data.OData.ODataCollectionWriter to use.
graph
objectThe collection to write.
collectionType
IEdmTypeReferenceThe EDM type of the collection.
writeContext
ODataSerializerContextThe serializer context.
WriteObject(object, Type, ODataMessageWriter, ODataSerializerContext)
public override void WriteObject(object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)
Parameters
graph
objecttype
TypemessageWriter
ODataMessageWriterwriteContext
ODataSerializerContext