Class JsonSerializable
Represents the base class for Azure Cosmos DB database objects and provides methods for serializing and deserializing from JSON.
public abstract class JsonSerializable
- Inheritance
-
JsonSerializable
- Derived
- Inherited Members
- Extension Methods
Methods
LoadFrom(JsonReader)
Loads the object from the specified JSON reader in the Azure Cosmos DB service.
public virtual void LoadFrom(JsonReader reader)
Parameters
reader
JsonReaderLoads the object from this JSON reader.
LoadFrom(JsonReader, JsonSerializerSettings)
Loads the object from the specified JSON reader in the Azure Cosmos DB service.
public virtual void LoadFrom(JsonReader reader, JsonSerializerSettings serializerSettings)
Parameters
reader
JsonReaderLoads the object from this JSON reader.
serializerSettings
JsonSerializerSettingsThe JsonSerializerSettings to be used.
LoadFromWithConstructor<T>(Stream, Func<T>)
Deserializes the specified stream using the given constructor in the Azure Cosmos DB service.
public static T LoadFromWithConstructor<T>(Stream stream, Func<T> constructorFunction)
Parameters
stream
StreamThe stream to load from.
constructorFunction
Func<T>The constructor used for the returning object.
Returns
- T
The object loaded from the specified stream.
Type Parameters
T
The type of the object.
LoadFromWithConstructor<T>(Stream, Func<T>, JsonSerializerSettings)
Deserializes the specified stream using the given constructor in the Azure Cosmos DB service.
public static T LoadFromWithConstructor<T>(Stream stream, Func<T> constructorFunction, JsonSerializerSettings settings)
Parameters
stream
StreamThe stream to load from.
constructorFunction
Func<T>The constructor used for the returning object.
settings
JsonSerializerSettingsThe JsonSerializerSettings to be used.
Returns
- T
The object loaded from the specified stream.
Type Parameters
T
The type of the object.
LoadFrom<T>(Stream)
Loads the object from the specified stream in the Azure Cosmos DB service.
public static T LoadFrom<T>(Stream stream) where T : JsonSerializable, new()
Parameters
stream
StreamThe stream to load from.
Returns
- T
The object loaded from the specified stream.
Type Parameters
T
The type of the returning object.
SaveTo(Stream, SerializationFormattingPolicy)
Saves the object to the specified stream in the Azure Cosmos DB service.
public void SaveTo(Stream stream, SerializationFormattingPolicy formattingPolicy = SerializationFormattingPolicy.None)
Parameters
stream
StreamSaves the object to this output stream.
formattingPolicy
SerializationFormattingPolicyUses an optional serialization formatting policy when saving the object. The default policy is set to None.
SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings)
Saves the object to the specified stream in the Azure Cosmos DB service.
public void SaveTo(Stream stream, SerializationFormattingPolicy formattingPolicy, JsonSerializerSettings settings)
Parameters
stream
StreamSaves the object to this output stream.
formattingPolicy
SerializationFormattingPolicyUses a custom serialization formatting policy when saving the object.
settings
JsonSerializerSettingsThe serializer settings to use.
ToString()
Returns the string representation of the object in the Azure Cosmos DB service.
public override string ToString()
Returns
- string
The string representation of the object.