Skip to content

Commit

Permalink
drop GetDeserializer methods
Browse files Browse the repository at this point in the history
  • Loading branch information
freels committed Jan 18, 2024
1 parent b9502d3 commit 6fe9b35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Fauna/Client/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Task<QuerySuccess<T>> QueryAsync<T>(
Query query,
QueryOptions? queryOptions = null)
where T : notnull =>
QueryAsync<T>(query, _serializationCtx.GetDeserializer<T>(), queryOptions);
QueryAsync<T>(query, Deserializer.Generate<T>(_serializationCtx), queryOptions);

/// <summary>
/// Asynchronously executes a specified FQL query against the Fauna database.
Expand Down Expand Up @@ -161,7 +161,7 @@ public IAsyncEnumerable<Page<T>> PaginateAsync<T>(
Query query,
QueryOptions? queryOptions = null)
where T : notnull =>
PaginateAsync(query, _serializationCtx.GetDeserializer<T>(), queryOptions);
PaginateAsync(query, Deserializer.Generate<T>(_serializationCtx), queryOptions);

/// <summary>
/// Asynchronously iterates over pages of a Fauna query result, automatically fetching subsequent pages using the 'after' cursor.
Expand Down
2 changes: 1 addition & 1 deletion Fauna/Exceptions/AbortException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public AbortException(SerializationContext ctx, QueryFailure queryFailure, strin
/// <typeparam name="T">The type to which the data should be deserialized.</typeparam>
/// <param name="deserializer">A deserializer for the abort data.</param>
/// <returns>The deserialized data as the specified type, or null if no data is available.</returns>
public T? GetData<T>() where T : notnull => GetData(_serializationCtx.GetDeserializer<T>());
public T? GetData<T>() where T : notnull => GetData(Deserializer.Generate<T>(_serializationCtx));

/// <summary>
/// Retrieves the deserialized data associated with the abort operation as a specific type.
Expand Down
22 changes: 0 additions & 22 deletions Fauna/Serialization/SerializationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,6 @@ public class SerializationContext
{
private readonly Dictionary<Type, Dictionary<string, FieldAttribute>> _registry = new();

/// <summary>
/// Get a deserializer for values of type T.
/// </summary>
/// <typeparam name="T">The result type of the returned deserializer.</typeparam>
/// <returns>An <see cref="IDeserializer{T}"/> which deserializes values of type T from their corresponding query results.</returns>
public IDeserializer<T> GetDeserializer<T>() where T : notnull
{
// FIXME(matt) cache this
return Deserializer.Generate<T>(this);
}

/// <summary>
/// Get a deserializer for values of type ty.
/// </summary>
/// <param name="ty">The result type of the returned deserializer.</typeparam>
/// <returns>An <see cref="IDeserializer"/> which deserializes values of type `ty` from their corresponding query results.</returns>
public IDeserializer GetDeserializer(Type ty)
{
// FIXME(matt) cache this
return Deserializer.Generate(this, ty);
}

/// <summary>
/// Retrieves the mapping of property names to their corresponding <see cref="FieldAttribute"/> for a given .NET type.
/// </summary>
Expand Down

0 comments on commit 6fe9b35

Please sign in to comment.