Class NullableDbTypeJsonConverter
- Namespace
- BiExcellence.OpenBi.Api.DataProviders
- Assembly
- BiExcellence.OpenBi.Api.Client.dll
Reads and writes an optional System.Data.DbType by name, the same way the required ones on the same
payload are written. JsonStringEnumConverter<DbType> converts System.Data.DbType itself and
not System.Nullable<T> of it, so a property that may say "not stated" needs this one instead.
Mirrors the server-side converter of the same name.
public sealed class NullableDbTypeJsonConverter : JsonConverter<DbType?>
- Inheritance
-
objectJsonConverterJsonConverter<DbType?>NullableDbTypeJsonConverter
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type System.Data.DbType?.
public override DbType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- DbType?
The converted value.
Write(Utf8JsonWriter, DbType?, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, DbType? value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueDbType?The value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.