Fauna v10 .NET/C# Driver
0.2.0-beta
Loading...
Searching...
No Matches
Fauna
Serialization
Serializers
CheckedSerializer.cs
Go to the documentation of this file.
1
using
Fauna.Mapping
;
2
3
namespace
Fauna.Serialization
;
4
5
internal
class
CheckedSerializer<T> : BaseSerializer<T>
6
{
7
public
override
T Deserialize(
MappingContext
context, ref Utf8FaunaReader reader)
8
{
9
var obj = DynamicSerializer.Singleton.Deserialize(context, ref reader);
10
11
if
(obj is T v)
return
v;
12
13
throw
new
SerializationException(
14
$
"Expected type {typeof(T)} but received {obj?.GetType()}"
);
15
}
16
17
public
override
void
Serialize(
MappingContext
context, Utf8FaunaWriter writer,
object
? o)
18
{
19
DynamicSerializer.Singleton.Serialize(context, writer, o);
20
}
21
}
Fauna.Mapping.MappingContext
A class representing the mapping context to be used during serialization and deserialization.
Definition
MappingContext.cs:9
Fauna.Mapping
Definition
Attributes.cs:1
Fauna.Serialization
Definition
ISerializer.cs:3
Generated by
1.12.0