From c28a75fe3a25ea7d255391d4d12295ec939855b2 Mon Sep 17 00:00:00 2001 From: Ben Callaghan Date: Thu, 30 Apr 2020 14:47:02 -0600 Subject: [PATCH] Added documentation for min/max integer rules --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index fc17f984..807deb7f 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,27 @@ Integer and derived types Not all numeric types defined by XML Schema can be safely and accurately mapped to .NET numeric data types, however, it's possible to approximate the mapping based on the integer bounds and restrictions such as `totalDigits`. If an explicit integer type mapping is specified via `--integer=TYPE`, that type will be used, otherwise an approximation will be made based on the table below. If you additionally specify `--fallback`, the type specified via `--integer=TYPE` will be used only if no type can be deduced by applying the rules below. +If the restrictions `minInclusive` and `maxInclusive` are present on the integer element, then the smallest CLR type that fully encompasses the specified range will be used. Unsigned types are given precedence over signed types. The following table shows the possible ranges and their corresponding CLR type, in the order they will be applied. + + + + + + + + + + + + + + + + +
Minimum (Inclusive)Maximum (Inclusive)C# type
sbyte.MinValuesbyte.MaxValuesbyte
byte.MinValuebyte.MaxValuebyte
ushort.MinValueushort.MaxValueushort
short.MinValueshort.MaxValueshort
uint.MinValueuint.MaxValueuint
int.MinValueint.MaxValueint
ulong.MinValueulong.MaxValueulong
long.MinValuelong.MaxValuelong
decimal.MinValuedecimal.MaxValuedecimal
+ +If the range specified by `minInclusive` and `maxInclusive` does not fit in any CLR type, or if those restrictions are not present, then the `totalDigits` restriction will be used, as shown in the following table. +
XML Schema type