MoneyOfTCurrencyJsonConverterFactory Class
Definition
- Assembly
- Bodu.Financial.Serialization.Json.dll
- Package
- Bodu.Financial.Serialization.Json 1.0.0
Creates MoneyOfTCurrencyJsonConverter<TCurrency> instances for closed Money<TCurrency> types, applying a configurable FinancialJsonPolicy to every closed converter the factory produces.
public sealed class MoneyOfTCurrencyJsonConverterFactory : JsonConverterFactory
- Inheritance
-
MoneyOfTCurrencyJsonConverterFactory
- Inherited Members
- Extension Methods
Remarks
The factory is registered on JsonSerializerOptions via AddFinancialJsonConverters(JsonSerializerOptions, FinancialJsonPolicy) (or added directly to Converters); the parameterless constructor defaults to Strict.
Constructors
MoneyOfTCurrencyJsonConverterFactory()
Initializes a new instance of the MoneyOfTCurrencyJsonConverterFactory class configured for the Strict shape.
public MoneyOfTCurrencyJsonConverterFactory()
MoneyOfTCurrencyJsonConverterFactory(FinancialJsonPolicy)
Initializes a new instance of the MoneyOfTCurrencyJsonConverterFactory class configured for the
supplied policy.
public MoneyOfTCurrencyJsonConverterFactory(FinancialJsonPolicy policy)
Parameters
policyFinancialJsonPolicyThe policy applied to every closed converter the factory produces.
Exceptions
- ArgumentOutOfRangeException
policyis not a defined FinancialJsonPolicy value.
Methods
CanConvert(Type)
Determines whether this factory can create a converter for the specified type.
public override bool CanConvert(Type typeToConvert)
Parameters
typeToConvertTypeThe candidate type.
Returns
- bool
true if
typeToConvertis a closed Money<TCurrency> type; otherwise false.
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for the specified closed Money<TCurrency> type.
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
Parameters
typeToConvertTypeThe closed Money<TCurrency> type to convert.
optionsJsonSerializerOptionsThe serializer options in effect.
Returns
- JsonConverter
A converter for
typeToConvert.
Exceptions
- ArgumentNullException
Thrown when
typeToConvertis null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |