Repository navigation
Description
What you're trying to do
Wrap .NET 11's new decimal types, and BFloat16, in a value object: readonly partial record struct Price : IValue<Decimal128>;. .NET 11 adds Decimal32, Decimal64 and Decimal128, with generic math and built-in System.Text.Json converters (JsonMetadataServices.Decimal128Converter and siblings; What's new in .NET 11 libraries).
What you'd like
A value object over each of them gets the generated surface its wrapped type supports, on a net11.0 consumer: JSON byte for byte as the wrapped type's (JsonParityTests, through GeneratedJsonPlan<T>), parsing, formatting, comparison and the type converter.
- The generators key on the wrapped type's interfaces, so no new generated member is expected (decision 120, rule 3). Rows for the four types join the wrapped-type axes, and the tests run on
net11.0. - The changelog and
docs/value-objects.mdmention them, if they work. If a member is missing or wrong, that's a bug filed on its own. - Also to measure: .NET 11 now rounds decimal and BigInteger-to-floating conversions correctly, with no compatibility switch. Check whether
DecimalJsonConverters.csor any generated member converts throughdoubleand would print differently onnet11.0.
BFloat16 too. .NET 11 adds System.Numerics.BFloat16 with a built-in converter (JsonMetadataServices.BFloat16Converter) that honours JsonNumberHandling (AllowReadingFromString, WriteAsString, AllowNamedFloatingPointLiterals), works as a dictionary key and exports a JSON Schema (dotnet/runtime#131523). A value object over it gets the same rows as the three decimals: number handling, dictionary keys, and an OpenAPI schema that is the wrapped type's.
EF Core: no provider mapping is expected for the new types. Record what EF 11 does with one, and leave it out of scope unless it's silent.
Does it change something that compiles or works today?
No, it only adds coverage. The rounding check could find a difference between targets, which would be a bug.
Activity
[-]Value objects over Decimal32, Decimal64 and Decimal128 (net11.0)[/-][+]Value objects over Decimal32, Decimal64, Decimal128 and BFloat16 (net11.0)[/+]