Skip to content

Commit 0bcbd55

Browse files
authored
Add missing integer schema types (#5451)
1 parent 71c912e commit 0bcbd55

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/DataContract.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,16 @@ static public bool TryCreateBuiltInDataContract(string name, string ns, out Data
962962
dataContract = new UnsignedIntDataContract();
963963
else if (DictionaryGlobals.LongLocalName.Value == name)
964964
dataContract = new LongDataContract();
965+
else if (DictionaryGlobals.IntegerLocalName.Value == name)
966+
dataContract = new IntegerDataContract();
967+
else if (DictionaryGlobals.PositiveIntegerLocalName.Value == name)
968+
dataContract = new PositiveIntegerDataContract();
969+
else if (DictionaryGlobals.NonPositiveIntegerLocalName.Value == name)
970+
dataContract = new NonPositiveIntegerDataContract();
971+
else if (DictionaryGlobals.NegativeIntegerLocalName.Value == name)
972+
dataContract = new NegativeIntegerDataContract();
973+
else if (DictionaryGlobals.NonNegativeIntegerLocalName.Value == name)
974+
dataContract = new NonNegativeIntegerDataContract();
965975
else if (DictionaryGlobals.UnsignedLongLocalName.Value == name)
966976
dataContract = new UnsignedLongDataContract();
967977
else if (DictionaryGlobals.FloatLocalName.Value == name)

src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/DictionaryGlobals.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ internal static class DictionaryGlobals
5555
public readonly static XmlDictionaryString UriLocalName;
5656
public readonly static XmlDictionaryString QNameLocalName;
5757
public readonly static XmlDictionaryString Space;
58+
public readonly static XmlDictionaryString IntegerLocalName;
59+
public readonly static XmlDictionaryString PositiveIntegerLocalName;
60+
public readonly static XmlDictionaryString NegativeIntegerLocalName;
61+
public readonly static XmlDictionaryString NonPositiveIntegerLocalName;
62+
public readonly static XmlDictionaryString NonNegativeIntegerLocalName;
5863

5964
public readonly static XmlDictionaryString hexBinaryLocalName;
6065
static DictionaryGlobals()
@@ -111,7 +116,16 @@ static DictionaryGlobals()
111116
ClrAssemblyLocalName = dictionary.Add(Globals.ClrAssemblyLocalName);
112117
Space = dictionary.Add(Globals.Space);
113118

119+
// 35
114120
hexBinaryLocalName = dictionary.Add("hexBinary");
121+
IntegerLocalName = dictionary.Add("integer");
122+
PositiveIntegerLocalName = dictionary.Add("positiveInteger");
123+
NegativeIntegerLocalName = dictionary.Add("negativeInteger");
124+
NonPositiveIntegerLocalName = dictionary.Add("nonPositiveInteger");
125+
126+
// 40
127+
NonNegativeIntegerLocalName = dictionary.Add("nonNegativeInteger");
128+
115129
// Add new templates here
116130
}
117131
catch (Exception ex)

src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/PrimitiveDataContract.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,51 @@ public override object ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializ
460460
}
461461
}
462462

463+
#if NET_NATIVE
464+
public class IntegerDataContract : LongDataContract
465+
#else
466+
internal class IntegerDataContract : LongDataContract
467+
#endif
468+
{
469+
internal IntegerDataContract() : base(DictionaryGlobals.IntegerLocalName, DictionaryGlobals.SchemaNamespace) { }
470+
}
471+
472+
#if NET_NATIVE
473+
public class PositiveIntegerDataContract : LongDataContract
474+
#else
475+
internal class PositiveIntegerDataContract : LongDataContract
476+
#endif
477+
{
478+
internal PositiveIntegerDataContract() : base(DictionaryGlobals.PositiveIntegerLocalName, DictionaryGlobals.SchemaNamespace) { }
479+
}
480+
481+
#if NET_NATIVE
482+
public class NegativeIntegerDataContract : LongDataContract
483+
#else
484+
internal class NegativeIntegerDataContract : LongDataContract
485+
#endif
486+
{
487+
internal NegativeIntegerDataContract() : base(DictionaryGlobals.NegativeIntegerLocalName, DictionaryGlobals.SchemaNamespace) { }
488+
}
489+
490+
#if NET_NATIVE
491+
public class NonPositiveIntegerDataContract : LongDataContract
492+
#else
493+
internal class NonPositiveIntegerDataContract : LongDataContract
494+
#endif
495+
{
496+
internal NonPositiveIntegerDataContract() : base(DictionaryGlobals.NonPositiveIntegerLocalName, DictionaryGlobals.SchemaNamespace) { }
497+
}
498+
499+
#if NET_NATIVE
500+
public class NonNegativeIntegerDataContract : LongDataContract
501+
#else
502+
internal class NonNegativeIntegerDataContract : LongDataContract
503+
#endif
504+
{
505+
internal NonNegativeIntegerDataContract() : base(DictionaryGlobals.NonNegativeIntegerLocalName, DictionaryGlobals.SchemaNamespace) { }
506+
}
507+
463508
#if NET_NATIVE
464509
public class FloatDataContract : PrimitiveDataContract
465510
#else

0 commit comments

Comments
 (0)