Class GraphJsonConverterFactory
- Namespace
- Arc4u
- Assembly
- Arc4u.dll
Creates the System.Text.Json converter of a Graph<T>, which writes the graph as {"Includes":[...]}
and reads it back without checking the paths. It works with the reflection-based serializer and with the source generator.
public sealed class GraphJsonConverterFactory : JsonConverterFactory
- Inheritance
-
GraphJsonConverterFactory
- Inherited Members
Methods
CanConvert(Type)
When overridden in a derived class, determines whether the converter instance can convert the specified object type.
public override bool CanConvert(Type typeToConvert)
Parameters
typeToConvertTypeThe type of the object to check whether it can be converted by this converter instance.
Returns
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for a specified type.
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(Graph<>.IncludesJsonConverter))]
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "The constructor of the converter is kept by the DynamicDependency.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Graph<T> constrains T to a reference type, so the converter runs on the code shared by all reference types, which native AOT generates.")]
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
typeToConvertTypeThe type handled by the converter.
optionsJsonSerializerOptionsThe serialization options to use.
Returns
- JsonConverter
A converter for which
Tis compatible withtypeToConvert.