Class TcgDexJsonContext
- Namespace
- TcgDex.Serialization
- Assembly
- TcgDex.CSharpSdk.dll
Source-generated serialization metadata for every type the SDK exchanges with the API.
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, PropertyNameCaseInsensitive = true, ReadCommentHandling = JsonCommentHandling.Disallow, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(Card))]
[JsonSerializable(typeof(CardBrief))]
[JsonSerializable(typeof(IReadOnlyList<CardBrief>))]
[JsonSerializable(typeof(Set))]
[JsonSerializable(typeof(SetBrief))]
[JsonSerializable(typeof(IReadOnlyList<SetBrief>))]
[JsonSerializable(typeof(Serie))]
[JsonSerializable(typeof(SerieBrief))]
[JsonSerializable(typeof(IReadOnlyList<SerieBrief>))]
[JsonSerializable(typeof(Attack))]
[JsonSerializable(typeof(Ability))]
[JsonSerializable(typeof(WeaknessOrResistance))]
[JsonSerializable(typeof(Legality))]
[JsonSerializable(typeof(Variants))]
[JsonSerializable(typeof(DetailedVariant))]
[JsonSerializable(typeof(Booster))]
[JsonSerializable(typeof(CardCount))]
[JsonSerializable(typeof(SetAbbreviation))]
[JsonSerializable(typeof(Pricing))]
[JsonSerializable(typeof(CardmarketPricing))]
[JsonSerializable(typeof(TcgPlayerPricing))]
[JsonSerializable(typeof(TcgPlayerPrice))]
[JsonSerializable(typeof(TcgDexProblem))]
[JsonSerializable(typeof(IReadOnlyList<string>))]
[JsonSerializable(typeof(IReadOnlyList<int>))]
public sealed class TcgDexJsonContext : JsonSerializerContext, IJsonTypeInfoResolverInheritance
Implements
Inherited Members
Remarks
Generating the metadata at compile time keeps the SDK trim- and AOT-safe and avoids the reflection cost on the first call for each type. Any model added to the SDK must be registered here or it will fail to serialize at runtime.
Constructors
TcgDexJsonContext()
public TcgDexJsonContext()TcgDexJsonContext(JsonSerializerOptions)
Creates an instance of System.Text.Json.Serialization.JsonSerializerContext and binds it with the indicated System.Text.Json.JsonSerializerOptions.
public TcgDexJsonContext(JsonSerializerOptions options)Parameters
optionsJsonSerializerOptions-
The run time provided options for the context instance.
Properties
Ability
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Ability> Ability { get; }Property Value
Attack
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Attack> Attack { get; }Property Value
Boolean
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<bool> Boolean { get; }Property Value
Booster
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Booster> Booster { get; }Property Value
Card
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Card> Card { get; }Property Value
CardBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<CardBrief> CardBrief { get; }Property Value
CardCount
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<CardCount> CardCount { get; }Property Value
CardmarketPricing
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<CardmarketPricing> CardmarketPricing { get; }Property Value
DateTimeOffset
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<DateTimeOffset> DateTimeOffset { get; }Property Value
Decimal
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<decimal> Decimal { get; }Property Value
Default
The default System.Text.Json.Serialization.JsonSerializerContext associated with a default System.Text.Json.JsonSerializerOptions instance.
public static TcgDexJsonContext Default { get; }Property Value
DetailedVariant
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<DetailedVariant> DetailedVariant { get; }Property Value
GeneratedSerializerOptions
The source-generated options associated with this context.
protected override JsonSerializerOptions? GeneratedSerializerOptions { get; }Property Value
IReadOnlyListAbility
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<Ability>> IReadOnlyListAbility { get; }Property Value
IReadOnlyListAttack
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<Attack>> IReadOnlyListAttack { get; }Property Value
IReadOnlyListBooster
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<Booster>> IReadOnlyListBooster { get; }Property Value
IReadOnlyListCardBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<CardBrief>> IReadOnlyListCardBrief { get; }Property Value
IReadOnlyListDetailedVariant
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<DetailedVariant>> IReadOnlyListDetailedVariant { get; }Property Value
IReadOnlyListInt32
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<int>> IReadOnlyListInt32 { get; }Property Value
IReadOnlyListSerieBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<SerieBrief>> IReadOnlyListSerieBrief { get; }Property Value
IReadOnlyListSetBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<SetBrief>> IReadOnlyListSetBrief { get; }Property Value
IReadOnlyListString
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<string>> IReadOnlyListString { get; }Property Value
IReadOnlyListWeaknessOrResistance
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<IReadOnlyList<WeaknessOrResistance>> IReadOnlyListWeaknessOrResistance { get; }Property Value
Int32
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<int> Int32 { get; }Property Value
Legality
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Legality> Legality { get; }Property Value
NullableDateTimeOffset
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<DateTimeOffset?> NullableDateTimeOffset { get; }Property Value
NullableDecimal
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<decimal?> NullableDecimal { get; }Property Value
NullableInt32
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<int?> NullableInt32 { get; }Property Value
Pricing
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Pricing> Pricing { get; }Property Value
Serie
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Serie> Serie { get; }Property Value
SerieBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<SerieBrief> SerieBrief { get; }Property Value
Set
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Set> Set { get; }Property Value
SetAbbreviation
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<SetAbbreviation> SetAbbreviation { get; }Property Value
SetBrief
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<SetBrief> SetBrief { get; }Property Value
String
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<string> String { get; }Property Value
TcgDexProblem
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<TcgDexProblem> TcgDexProblem { get; }Property Value
TcgPlayerPrice
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<TcgPlayerPrice> TcgPlayerPrice { get; }Property Value
TcgPlayerPricing
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<TcgPlayerPricing> TcgPlayerPricing { get; }Property Value
Variants
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<Variants> Variants { get; }Property Value
WeaknessOrResistance
Defines the source generated JSON serialization contract metadata for a given type.
public JsonTypeInfo<WeaknessOrResistance> WeaknessOrResistance { get; }Property Value
Methods
GetTypeInfo(Type)
Gets metadata for the specified type.
public override JsonTypeInfo? GetTypeInfo(Type type)Parameters
typeType-
The type to fetch metadata for.
Returns
- JsonTypeInfo?
-
The metadata for the specified type, or null if the context has no metadata for the type.