Table of Contents

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, IJsonTypeInfoResolver

Inheritance

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

options JsonSerializerOptions

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

JsonTypeInfo<Ability>

Attack

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Attack> Attack { get; }

Property Value

JsonTypeInfo<Attack>

Boolean

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<bool> Boolean { get; }

Property Value

JsonTypeInfo<bool>

Booster

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Booster> Booster { get; }

Property Value

JsonTypeInfo<Booster>

Card

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Card> Card { get; }

Property Value

JsonTypeInfo<Card>

CardBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<CardBrief> CardBrief { get; }

Property Value

JsonTypeInfo<CardBrief>

CardCount

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<CardCount> CardCount { get; }

Property Value

JsonTypeInfo<CardCount>

CardmarketPricing

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<CardmarketPricing> CardmarketPricing { get; }

Property Value

JsonTypeInfo<CardmarketPricing>

DateTimeOffset

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<DateTimeOffset> DateTimeOffset { get; }

Property Value

JsonTypeInfo<DateTimeOffset>

Decimal

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<decimal> Decimal { get; }

Property Value

JsonTypeInfo<decimal>

Default

The default System.Text.Json.Serialization.JsonSerializerContext associated with a default System.Text.Json.JsonSerializerOptions instance.

public static TcgDexJsonContext Default { get; }

Property Value

TcgDexJsonContext

DetailedVariant

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<DetailedVariant> DetailedVariant { get; }

Property Value

JsonTypeInfo<DetailedVariant>

GeneratedSerializerOptions

The source-generated options associated with this context.

protected override JsonSerializerOptions? GeneratedSerializerOptions { get; }

Property Value

JsonSerializerOptions?

IReadOnlyListAbility

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<Ability>> IReadOnlyListAbility { get; }

Property Value

JsonTypeInfo<IReadOnlyList<Ability>>

IReadOnlyListAttack

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<Attack>> IReadOnlyListAttack { get; }

Property Value

JsonTypeInfo<IReadOnlyList<Attack>>

IReadOnlyListBooster

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<Booster>> IReadOnlyListBooster { get; }

Property Value

JsonTypeInfo<IReadOnlyList<Booster>>

IReadOnlyListCardBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<CardBrief>> IReadOnlyListCardBrief { get; }

Property Value

JsonTypeInfo<IReadOnlyList<CardBrief>>

IReadOnlyListDetailedVariant

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<DetailedVariant>> IReadOnlyListDetailedVariant { get; }

Property Value

JsonTypeInfo<IReadOnlyList<DetailedVariant>>

IReadOnlyListInt32

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<int>> IReadOnlyListInt32 { get; }

Property Value

JsonTypeInfo<IReadOnlyList<int>>

IReadOnlyListSerieBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<SerieBrief>> IReadOnlyListSerieBrief { get; }

Property Value

JsonTypeInfo<IReadOnlyList<SerieBrief>>

IReadOnlyListSetBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<SetBrief>> IReadOnlyListSetBrief { get; }

Property Value

JsonTypeInfo<IReadOnlyList<SetBrief>>

IReadOnlyListString

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<string>> IReadOnlyListString { get; }

Property Value

JsonTypeInfo<IReadOnlyList<string>>

IReadOnlyListWeaknessOrResistance

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<IReadOnlyList<WeaknessOrResistance>> IReadOnlyListWeaknessOrResistance { get; }

Property Value

JsonTypeInfo<IReadOnlyList<WeaknessOrResistance>>

Int32

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<int> Int32 { get; }

Property Value

JsonTypeInfo<int>

Legality

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Legality> Legality { get; }

Property Value

JsonTypeInfo<Legality>

NullableDateTimeOffset

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<DateTimeOffset?> NullableDateTimeOffset { get; }

Property Value

JsonTypeInfo<DateTimeOffset?>

NullableDecimal

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<decimal?> NullableDecimal { get; }

Property Value

JsonTypeInfo<decimal?>

NullableInt32

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<int?> NullableInt32 { get; }

Property Value

JsonTypeInfo<int?>

Pricing

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Pricing> Pricing { get; }

Property Value

JsonTypeInfo<Pricing>

Serie

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Serie> Serie { get; }

Property Value

JsonTypeInfo<Serie>

SerieBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<SerieBrief> SerieBrief { get; }

Property Value

JsonTypeInfo<SerieBrief>

Set

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Set> Set { get; }

Property Value

JsonTypeInfo<Set>

SetAbbreviation

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<SetAbbreviation> SetAbbreviation { get; }

Property Value

JsonTypeInfo<SetAbbreviation>

SetBrief

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<SetBrief> SetBrief { get; }

Property Value

JsonTypeInfo<SetBrief>

String

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<string> String { get; }

Property Value

JsonTypeInfo<string>

TcgDexProblem

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<TcgDexProblem> TcgDexProblem { get; }

Property Value

JsonTypeInfo<TcgDexProblem>

TcgPlayerPrice

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<TcgPlayerPrice> TcgPlayerPrice { get; }

Property Value

JsonTypeInfo<TcgPlayerPrice>

TcgPlayerPricing

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<TcgPlayerPricing> TcgPlayerPricing { get; }

Property Value

JsonTypeInfo<TcgPlayerPricing>

Variants

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<Variants> Variants { get; }

Property Value

JsonTypeInfo<Variants>

WeaknessOrResistance

Defines the source generated JSON serialization contract metadata for a given type.

public JsonTypeInfo<WeaknessOrResistance> WeaknessOrResistance { get; }

Property Value

JsonTypeInfo<WeaknessOrResistance>

Methods

GetTypeInfo(Type)

Gets metadata for the specified type.

public override JsonTypeInfo? GetTypeInfo(Type type)

Parameters

type Type

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.