Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
ModuleSerializer.cs
Go to the documentation of this file.
2using Fauna.Mapping;
3using Fauna.Types;
4
5namespace Fauna.Serialization;
6
7
8internal class ModuleSerializer : BaseSerializer<Module>
9{
10 public override List<FaunaType> GetSupportedTypes() => new List<FaunaType> { FaunaType.Module, FaunaType.Null };
11
12 public override Module Deserialize(MappingContext ctx, ref Utf8FaunaReader reader) =>
13 reader.CurrentTokenType switch
14 {
15 TokenType.Module => reader.GetModule(),
16 _ => throw UnexpectedToken(reader.CurrentTokenType)
17 };
18
19 public override void Serialize(MappingContext context, Utf8FaunaWriter writer, object? o)
20 {
21 switch (o)
22 {
23 case null:
24 writer.WriteNullValue();
25 break;
26 case Module module:
27 writer.WriteModuleValue(module);
28 break;
29 default:
31 }
32 }
33}
Represents error that occur during serialization and deserialization of Fauna data.
A class representing the mapping context to be used during serialization and deserialization.
string UnsupportedSerializationTypeMessage(Type type)
A helper to build an unsupported serialization type exception message.
Represents a module, a singleton object grouping related functionalities. Modules are serialized as @...
Definition Module.cs:8
object? ISerializer. Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes or partially consumes the provided reader and deserializes into a result.
void ISerializer. Serialize(MappingContext context, Utf8FaunaWriter writer, object? o)
Serializes the provided object onto the Utf8FaunaWriter
FaunaType
An enum representing possible Fauna types.
Definition FaunaType.cs:7