From 6fe9b35a19a949bb7c5737a21bcd84b6c641e13e Mon Sep 17 00:00:00 2001 From: Matt Freels Date: Thu, 18 Jan 2024 14:56:17 -0700 Subject: [PATCH] drop GetDeserializer methods --- Fauna/Client/Client.cs | 4 ++-- Fauna/Exceptions/AbortException.cs | 2 +- Fauna/Serialization/SerializationContext.cs | 22 --------------------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Fauna/Client/Client.cs b/Fauna/Client/Client.cs index 9aa5bd9f..4a00f351 100644 --- a/Fauna/Client/Client.cs +++ b/Fauna/Client/Client.cs @@ -78,7 +78,7 @@ public Task> QueryAsync( Query query, QueryOptions? queryOptions = null) where T : notnull => - QueryAsync(query, _serializationCtx.GetDeserializer(), queryOptions); + QueryAsync(query, Deserializer.Generate(_serializationCtx), queryOptions); /// /// Asynchronously executes a specified FQL query against the Fauna database. @@ -161,7 +161,7 @@ public IAsyncEnumerable> PaginateAsync( Query query, QueryOptions? queryOptions = null) where T : notnull => - PaginateAsync(query, _serializationCtx.GetDeserializer(), queryOptions); + PaginateAsync(query, Deserializer.Generate(_serializationCtx), queryOptions); /// /// Asynchronously iterates over pages of a Fauna query result, automatically fetching subsequent pages using the 'after' cursor. diff --git a/Fauna/Exceptions/AbortException.cs b/Fauna/Exceptions/AbortException.cs index e4a9b063..22624239 100644 --- a/Fauna/Exceptions/AbortException.cs +++ b/Fauna/Exceptions/AbortException.cs @@ -36,7 +36,7 @@ public AbortException(SerializationContext ctx, QueryFailure queryFailure, strin /// The type to which the data should be deserialized. /// A deserializer for the abort data. /// The deserialized data as the specified type, or null if no data is available. - public T? GetData() where T : notnull => GetData(_serializationCtx.GetDeserializer()); + public T? GetData() where T : notnull => GetData(Deserializer.Generate(_serializationCtx)); /// /// Retrieves the deserialized data associated with the abort operation as a specific type. diff --git a/Fauna/Serialization/SerializationContext.cs b/Fauna/Serialization/SerializationContext.cs index 911d9de2..c821672d 100644 --- a/Fauna/Serialization/SerializationContext.cs +++ b/Fauna/Serialization/SerializationContext.cs @@ -10,28 +10,6 @@ public class SerializationContext { private readonly Dictionary> _registry = new(); - /// - /// Get a deserializer for values of type T. - /// - /// The result type of the returned deserializer. - /// An which deserializes values of type T from their corresponding query results. - public IDeserializer GetDeserializer() where T : notnull - { - // FIXME(matt) cache this - return Deserializer.Generate(this); - } - - /// - /// Get a deserializer for values of type ty. - /// - /// The result type of the returned deserializer. - /// An which deserializes values of type `ty` from their corresponding query results. - public IDeserializer GetDeserializer(Type ty) - { - // FIXME(matt) cache this - return Deserializer.Generate(this, ty); - } - /// /// Retrieves the mapping of property names to their corresponding for a given .NET type. ///