Class BinaryReflectiveSerializer
Binary serializer which reflectively writes all fields except of ones with
Note that Java platform stores dates as a difference between current time
and predefined absolute UTC date. Therefore, this difference is always the
same for all time zones. .NET, in contrast, stores dates as a difference
between current time and some predefined date relative to the current time
zone. It means that this difference will be different as you change time zones.
To overcome this discrepancy Ignite always converts .NET date to UTC form
before serializing and allows user to decide whether to deserialize them
in UTC or local form using ReadTimestamp(..., true/false)
methods in
IBinaryReader and IBinaryRawReader.
This serializer always read dates in UTC form. It means that if you have
local date in any field/property, it will be implicitly converted to UTC
form after the first serialization-deserialization cycle.
Inheritance
Implements
Namespace: Apache.Ignite.Core.Binary
Assembly: Apache.Ignite.Core.dll
Syntax
public sealed class BinaryReflectiveSerializer : object, IBinarySerializer
Properties
ForceTimestamp
Gets or sets a value indicating whether all DateTime values should be written as Timestamp.
Timestamp format is required for values used in SQL and for interoperation with other platforms. Only UTC values are supported in Timestamp format. Other values will cause an exception on write.
Normally serializer uses WriteObject<T>(String, T) for DateTime fields. This attribute changes the behavior to WriteTimestamp(String, Nullable<DateTime>).
See also TimestampAttribute, ForceTimestamp.
Declaration
public bool ForceTimestamp { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RawMode
Gets or value indicating whether raw mode serialization should be used.
Raw mode does not include field names, improving performance and memory usage. However, queries do not support raw objects.
Declaration
public bool RawMode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UnwrapNullablePrimitiveTypes
Gets or sets a value indicating whether primitive nullable object fields should be unwrapped and written as underlying type, instead of using WriteObject<T>(String, T).
This produces correct field type in binary metadata and is consistent with Java serializer behavior.
It is recommended to enable this setting, unless you need old behavior to preserve compatibility.
See also UnwrapNullablePrimitiveTypes.
Declaration
public bool UnwrapNullablePrimitiveTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
ReadBinary(Object, IBinaryReader)
Read binary object.
Declaration
public void ReadBinary(object obj, IBinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Instantiated empty object. |
IBinaryReader | reader | Binary reader. |
WriteBinary(Object, IBinaryWriter)
Write binary object.
Declaration
public void WriteBinary(object obj, IBinaryWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object. |
IBinaryWriter | writer | Binary writer. |