diff --git a/src/HotChocolate/Core/src/Types.NodaTime/DurationType.cs b/src/HotChocolate/Core/src/Types.NodaTime/DurationType.cs index 64c58e471f3..2b4e261e91a 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/DurationType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/DurationType.cs @@ -13,14 +13,6 @@ public class DurationType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public DurationType() : this(DurationPattern.Roundtrip) - { - } - /// /// Initializes a new instance of . /// @@ -36,6 +28,14 @@ public DurationType(params IPattern[] allowedPatterns) : base("Duratio Description = NodaTimeResources.DurationType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public DurationType() : this(DurationPattern.Roundtrip) + { + } + /// protected override string Serialize(Duration runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/InstantType.cs b/src/HotChocolate/Core/src/Types.NodaTime/InstantType.cs index e6aca316610..b130fc1bb67 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/InstantType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/InstantType.cs @@ -13,14 +13,6 @@ public class InstantType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public InstantType() : this(InstantPattern.ExtendedIso) - { - } - /// /// Initializes a new instance of . /// @@ -36,6 +28,14 @@ public InstantType(params IPattern[] allowedPatterns) : base("Instant") Description = NodaTimeResources.InstantType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public InstantType() : this(InstantPattern.ExtendedIso) + { + } + /// protected override string Serialize(Instant runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/LocalDateTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/LocalDateTimeType.cs index a674cb92ea5..a4da2049187 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/LocalDateTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/LocalDateTimeType.cs @@ -13,14 +13,6 @@ public class LocalDateTimeType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public LocalDateTimeType() : this(LocalDateTimePattern.ExtendedIso) - { - } - /// /// Initializes a new instance of . /// @@ -36,6 +28,14 @@ public LocalDateTimeType(params IPattern[] allowedPatterns) : bas Description = NodaTimeResources.LocalDateTimeType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public LocalDateTimeType() : this(LocalDateTimePattern.ExtendedIso) + { + } + /// protected override string Serialize(LocalDateTime runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/LocalDateType.cs b/src/HotChocolate/Core/src/Types.NodaTime/LocalDateType.cs index cf47116b090..c8718dc0da6 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/LocalDateType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/LocalDateType.cs @@ -14,14 +14,6 @@ public class LocalDateType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public LocalDateType() : this(LocalDatePattern.Iso) - { - } - /// /// Initializes a new instance of . /// @@ -37,6 +29,14 @@ public LocalDateType(params IPattern[] allowedPatterns) : base("Local Description = NodaTimeResources.LocalDateType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public LocalDateType() : this(LocalDatePattern.Iso) + { + } + /// protected override string Serialize(LocalDate runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/LocalTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/LocalTimeType.cs index 84e4f2e23b5..ec900a9fd70 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/LocalTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/LocalTimeType.cs @@ -14,14 +14,6 @@ public class LocalTimeType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public LocalTimeType() : this(LocalTimePattern.ExtendedIso) - { - } - /// /// Initializes a new instance of . /// @@ -37,6 +29,14 @@ public LocalTimeType(params IPattern[] allowedPatterns) : base("Local Description = NodaTimeResources.LocalTimeType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public LocalTimeType() : this(LocalTimePattern.ExtendedIso) + { + } + /// protected override string Serialize(LocalTime runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateTimeType.cs index 80582c7c903..ce747bded5a 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateTimeType.cs @@ -13,17 +13,6 @@ public class OffsetDateTimeType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public OffsetDateTimeType() : this(OffsetDateTimePattern.ExtendedIso) - { - // Backwards compatibility with the original code's behavior - _serializationPattern = OffsetDateTimePattern.GeneralIso; - _allowedPatterns = [OffsetDateTimePattern.ExtendedIso,]; - } - /// /// Initializes a new instance of . /// @@ -40,6 +29,17 @@ public OffsetDateTimeType(params IPattern[] allowedPatterns) Description = NodaTimeResources.OffsetDateTimeType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public OffsetDateTimeType() : this(OffsetDateTimePattern.ExtendedIso) + { + // Backwards compatibility with the original code's behavior + _serializationPattern = OffsetDateTimePattern.GeneralIso; + _allowedPatterns = [OffsetDateTimePattern.ExtendedIso,]; + } + /// protected override string Serialize(OffsetDateTime runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateType.cs b/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateType.cs index abd80dbef4c..64d31c5fc1c 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/OffsetDateType.cs @@ -15,14 +15,6 @@ public class OffsetDateType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public OffsetDateType() : this(OffsetDatePattern.GeneralIso) - { - } - /// /// Initializes a new instance of . /// @@ -38,6 +30,14 @@ public OffsetDateType(params IPattern[] allowedPatterns) : base("Off Description = NodaTimeResources.OffsetDateType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public OffsetDateType() : this(OffsetDatePattern.GeneralIso) + { + } + /// protected override string Serialize(OffsetDate runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/OffsetTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/OffsetTimeType.cs index bb662192f02..d5d2d60f109 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/OffsetTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/OffsetTimeType.cs @@ -14,14 +14,6 @@ public class OffsetTimeType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public OffsetTimeType() : this(OffsetTimePattern.GeneralIso) - { - } - /// /// Initializes a new instance of . /// @@ -37,6 +29,14 @@ public OffsetTimeType(params IPattern[] allowedPatterns) : base("Off Description = NodaTimeResources.OffsetTimeType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public OffsetTimeType() : this(OffsetTimePattern.GeneralIso) + { + } + /// protected override string Serialize(OffsetTime runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/OffsetType.cs b/src/HotChocolate/Core/src/Types.NodaTime/OffsetType.cs index 29385215e05..e643afbea1e 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/OffsetType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/OffsetType.cs @@ -15,14 +15,6 @@ public class OffsetType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public OffsetType() : this(OffsetPattern.GeneralInvariantWithZ) - { - } - /// /// Initializes a new instance of . /// @@ -38,6 +30,14 @@ public OffsetType(params IPattern[] allowedPatterns) : base("Offset") Description = NodaTimeResources.OffsetType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public OffsetType() : this(OffsetPattern.GeneralInvariantWithZ) + { + } + /// protected override string Serialize(Offset runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.NodaTime/PeriodType.cs b/src/HotChocolate/Core/src/Types.NodaTime/PeriodType.cs index 5aa80a4b12b..09a667919ed 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/PeriodType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/PeriodType.cs @@ -14,14 +14,6 @@ public class PeriodType : StringToClassBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public PeriodType() : this(PeriodPattern.Roundtrip) - { - } - /// /// Initializes a new instance of . /// @@ -37,6 +29,14 @@ public PeriodType(params IPattern[] allowedPatterns) : base("Period") Description = NodaTimeResources.PeriodType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public PeriodType() : this(PeriodPattern.Roundtrip) + { + } + /// protected override string Serialize(Period runtimeValue) => _serializationPattern.Format(runtimeValue); diff --git a/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs b/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs index 2b1b20ee432..b590839b787 100644 --- a/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs +++ b/src/HotChocolate/Core/src/Types.NodaTime/ZonedDateTimeType.cs @@ -19,14 +19,6 @@ public class ZonedDateTimeType : StringToStructBaseType private readonly IPattern[] _allowedPatterns; private readonly IPattern _serializationPattern; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public ZonedDateTimeType() : this(_default) - { - } - /// /// Initializes a new instance of . /// @@ -43,6 +35,14 @@ public ZonedDateTimeType(params IPattern[] allowedPatterns) Description = NodaTimeResources.ZonedDateTimeType_Description; } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public ZonedDateTimeType() : this(_default) + { + } + /// protected override string Serialize(ZonedDateTime runtimeValue) => _serializationPattern diff --git a/src/HotChocolate/Core/src/Types.Scalars.Upload/UploadType.cs b/src/HotChocolate/Core/src/Types.Scalars.Upload/UploadType.cs index f5d3b962245..be90ec49db3 100644 --- a/src/HotChocolate/Core/src/Types.Scalars.Upload/UploadType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars.Upload/UploadType.cs @@ -9,18 +9,6 @@ namespace HotChocolate.Types; /// public class UploadType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public UploadType() - : this( - "Upload", - UploadResources.UploadType_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -33,6 +21,18 @@ public UploadType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UploadType() + : this( + "Upload", + UploadResources.UploadType_Description, + BindingBehavior.Implicit) + { + } + public override IValueNode ParseResult(object? resultValue) { if (resultValue is null) diff --git a/src/HotChocolate/Core/src/Types.Scalars/EmailAddressType.cs b/src/HotChocolate/Core/src/Types.Scalars/EmailAddressType.cs index 2a420564b5b..1671694cfce 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/EmailAddressType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/EmailAddressType.cs @@ -32,15 +32,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public EmailAddressType() - : this( - WellKnownScalarTypes.EmailAddress, - ScalarResources.EmailAddressType_Description) { } - /// /// Initializes a new instance of the class. /// @@ -56,6 +47,15 @@ public EmailAddressType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public EmailAddressType() + : this( + WellKnownScalarTypes.EmailAddress, + ScalarResources.EmailAddressType_Description) { } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) => ThrowHelper.EmailAddressType_ParseLiteral_IsInvalid(this); diff --git a/src/HotChocolate/Core/src/Types.Scalars/HexColorType.cs b/src/HotChocolate/Core/src/Types.Scalars/HexColorType.cs index 7f91a355dd3..6b55f5748c0 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/HexColorType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/HexColorType.cs @@ -28,17 +28,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public HexColorType() - : this( - WellKnownScalarTypes.HexColor, - ScalarResources.HexColorType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -54,6 +43,17 @@ public HexColorType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public HexColorType() + : this( + WellKnownScalarTypes.HexColor, + ScalarResources.HexColorType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/HslType.cs b/src/HotChocolate/Core/src/Types.Scalars/HslType.cs index 18c7ad24e51..d1b016c02b1 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/HslType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/HslType.cs @@ -28,17 +28,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public HslType() - : this( - WellKnownScalarTypes.Hsl, - ScalarResources.HslType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -54,6 +43,17 @@ public HslType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public HslType() + : this( + WellKnownScalarTypes.Hsl, + ScalarResources.HslType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/HslaType.cs b/src/HotChocolate/Core/src/Types.Scalars/HslaType.cs index c74fa0a8a6a..ab04b45df25 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/HslaType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/HslaType.cs @@ -28,17 +28,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public HslaType() - : this( - WellKnownScalarTypes.Hsla, - ScalarResources.HslaType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -54,6 +43,17 @@ public HslaType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public HslaType() + : this( + WellKnownScalarTypes.Hsla, + ScalarResources.HslaType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs b/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs index 787765184e5..06eb4d81976 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs @@ -30,18 +30,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public IPv4Type() - : this( - WellKnownScalarTypes.IPv4, - ScalarResources.IPv4Type_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -57,6 +45,17 @@ public IPv4Type( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public IPv4Type() + : this( + WellKnownScalarTypes.IPv4, + ScalarResources.IPv4Type_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs b/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs index 1a1b74fce04..e42d91a858a 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs @@ -49,17 +49,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public IPv6Type() - : this( - WellKnownScalarTypes.IPv6, - ScalarResources.IPv6Type_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -75,6 +64,17 @@ public IPv6Type( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public IPv6Type() + : this( + WellKnownScalarTypes.IPv6, + ScalarResources.IPv6Type_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) => ThrowHelper.IPv6Type_ParseLiteral_IsInvalid(this); diff --git a/src/HotChocolate/Core/src/Types.Scalars/IsbnType.cs b/src/HotChocolate/Core/src/Types.Scalars/IsbnType.cs index 47f0d1fa458..bac8d51f280 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/IsbnType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/IsbnType.cs @@ -33,17 +33,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public IsbnType() - : this( - WellKnownScalarTypes.Isbn, - ScalarResources.IsbnType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -59,6 +48,17 @@ public IsbnType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public IsbnType() + : this( + WellKnownScalarTypes.Isbn, + ScalarResources.IsbnType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/LatitudeType.cs b/src/HotChocolate/Core/src/Types.Scalars/LatitudeType.cs index 65a46f157f3..6ea449685a2 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/LatitudeType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/LatitudeType.cs @@ -12,17 +12,6 @@ namespace HotChocolate.Types; /// public class LatitudeType : ScalarType { - /// - /// Initializes a new instance of - /// - [ActivatorUtilitiesConstructor] - public LatitudeType() - : this( - WellKnownScalarTypes.Latitude, - ScalarResources.LatitudeType_Description) - { - } - /// /// Initializes a new instance of /// @@ -34,6 +23,17 @@ public LatitudeType( { Description = description; } + + /// + /// Initializes a new instance of + /// + [ActivatorUtilitiesConstructor] + public LatitudeType() + : this( + WellKnownScalarTypes.Latitude, + ScalarResources.LatitudeType_Description) + { + } /// protected override bool IsInstanceOfType(double runtimeValue) => diff --git a/src/HotChocolate/Core/src/Types.Scalars/LocalCurrencyType.cs b/src/HotChocolate/Core/src/Types.Scalars/LocalCurrencyType.cs index f4005922be7..980a108142f 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/LocalCurrencyType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/LocalCurrencyType.cs @@ -12,17 +12,6 @@ public class LocalCurrencyType : ScalarType { private readonly CultureInfo _cultureInfo; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public LocalCurrencyType() - : this( - WellKnownScalarTypes.LocalCurrency, - description: ScalarResources.LocalCurrencyType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -39,6 +28,17 @@ public LocalCurrencyType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public LocalCurrencyType() + : this( + WellKnownScalarTypes.LocalCurrency, + description: ScalarResources.LocalCurrencyType_Description) + { + } + /// public override IValueNode ParseResult(object? resultValue) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/LocalDateType.cs b/src/HotChocolate/Core/src/Types.Scalars/LocalDateType.cs index 60b9a16c58a..52658543e08 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/LocalDateType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/LocalDateType.cs @@ -14,17 +14,6 @@ public class LocalDateType : ScalarType { private const string _localFormat = "yyyy-MM-dd"; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public LocalDateType() - : this( - WellKnownScalarTypes.LocalDate, - ScalarResources.LocalDateType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -37,6 +26,17 @@ public LocalDateType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public LocalDateType() + : this( + WellKnownScalarTypes.LocalDate, + ScalarResources.LocalDateType_Description) + { + } + public override IValueNode ParseResult(object? resultValue) { return resultValue switch diff --git a/src/HotChocolate/Core/src/Types.Scalars/LocalTimeType.cs b/src/HotChocolate/Core/src/Types.Scalars/LocalTimeType.cs index 51bf944cd6f..914326c8ee7 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/LocalTimeType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/LocalTimeType.cs @@ -13,17 +13,6 @@ public class LocalTimeType : ScalarType { private const string _localFormat = "HH:mm:ss"; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public LocalTimeType() - : this( - WellKnownScalarTypes.LocalTime, - ScalarResources.LocalTimeType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -36,6 +25,17 @@ public LocalTimeType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public LocalTimeType() + : this( + WellKnownScalarTypes.LocalTime, + ScalarResources.LocalTimeType_Description) + { + } + public override IValueNode ParseResult(object? resultValue) { return resultValue switch diff --git a/src/HotChocolate/Core/src/Types.Scalars/LongitudeType.cs b/src/HotChocolate/Core/src/Types.Scalars/LongitudeType.cs index 4811c7adc24..a42f82bb749 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/LongitudeType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/LongitudeType.cs @@ -12,17 +12,6 @@ namespace HotChocolate.Types; /// public class LongitudeType : ScalarType { - /// - /// Initializes a new instance of - /// - [ActivatorUtilitiesConstructor] - public LongitudeType() - : this( - WellKnownScalarTypes.Longitude, - ScalarResources.LongitudeType_Description) - { - } - /// /// Initializes a new instance of /// @@ -34,6 +23,17 @@ public LongitudeType( { Description = description; } + + /// + /// Initializes a new instance of + /// + [ActivatorUtilitiesConstructor] + public LongitudeType() + : this( + WellKnownScalarTypes.Longitude, + ScalarResources.LongitudeType_Description) + { + } /// protected override bool IsInstanceOfType(double runtimeValue) => diff --git a/src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs b/src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs index 99009ea4f72..9e3dbf39aae 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs @@ -32,17 +32,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public MacAddressType() - : this( - WellKnownScalarTypes.MacAddress, - ScalarResources.MacAddressType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -58,6 +47,17 @@ public MacAddressType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public MacAddressType() + : this( + WellKnownScalarTypes.MacAddress, + ScalarResources.MacAddressType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/NegativeFloatType.cs b/src/HotChocolate/Core/src/Types.Scalars/NegativeFloatType.cs index 77276362559..6aee6d64b5a 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NegativeFloatType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NegativeFloatType.cs @@ -7,17 +7,6 @@ namespace HotChocolate.Types; /// public class NegativeFloatType : FloatType { - /// - /// Initializes a new instance of - /// - [ActivatorUtilitiesConstructor] - public NegativeFloatType() - : this( - WellKnownScalarTypes.NegativeFloat, - ScalarResources.NegativeFloatType_Description) - { - } - /// /// Initializes a new instance of /// @@ -28,6 +17,17 @@ public NegativeFloatType( : base(name, description, double.MinValue, 0, bind) { } + + /// + /// Initializes a new instance of + /// + [ActivatorUtilitiesConstructor] + public NegativeFloatType() + : this( + WellKnownScalarTypes.NegativeFloat, + ScalarResources.NegativeFloatType_Description) + { + } /// protected override bool IsInstanceOfType(double runtimeValue) diff --git a/src/HotChocolate/Core/src/Types.Scalars/NegativeIntType.cs b/src/HotChocolate/Core/src/Types.Scalars/NegativeIntType.cs index 59483df73cf..ab3fd566688 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NegativeIntType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NegativeIntType.cs @@ -8,17 +8,6 @@ namespace HotChocolate.Types; /// public class NegativeIntType : IntType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public NegativeIntType() - : this( - WellKnownScalarTypes.NegativeInt, - ScalarResources.NegativeIntType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -30,6 +19,17 @@ public NegativeIntType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public NegativeIntType() + : this( + WellKnownScalarTypes.NegativeInt, + ScalarResources.NegativeIntType_Description) + { + } /// protected override bool IsInstanceOfType(int runtimeValue) diff --git a/src/HotChocolate/Core/src/Types.Scalars/NonEmptyStringType.cs b/src/HotChocolate/Core/src/Types.Scalars/NonEmptyStringType.cs index 4f328a2ebe9..1e287c8a7ad 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NonEmptyStringType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NonEmptyStringType.cs @@ -8,17 +8,6 @@ namespace HotChocolate.Types; /// public class NonEmptyStringType : StringType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public NonEmptyStringType() - : this( - WellKnownScalarTypes.NonEmptyString, - ScalarResources.NonEmptyStringType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -29,6 +18,17 @@ public NonEmptyStringType( : base(name, description, bind) { } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public NonEmptyStringType() + : this( + WellKnownScalarTypes.NonEmptyString, + ScalarResources.NonEmptyStringType_Description) + { + } /// protected override bool IsInstanceOfType(string runtimeValue) diff --git a/src/HotChocolate/Core/src/Types.Scalars/NonNegativeFloatType.cs b/src/HotChocolate/Core/src/Types.Scalars/NonNegativeFloatType.cs index 6e09eed2eb0..c438b551f13 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NonNegativeFloatType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NonNegativeFloatType.cs @@ -11,22 +11,22 @@ public class NonNegativeFloatType : FloatType /// /// Initializes a new instance of /// - [ActivatorUtilitiesConstructor] - public NonNegativeFloatType() - : this( - WellKnownScalarTypes.NonNegativeFloat, - ScalarResources.NonNegativeFloatType_Description) + public NonNegativeFloatType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, 0, double.MaxValue, bind) { } /// /// Initializes a new instance of /// - public NonNegativeFloatType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, 0, double.MaxValue, bind) + [ActivatorUtilitiesConstructor] + public NonNegativeFloatType() + : this( + WellKnownScalarTypes.NonNegativeFloat, + ScalarResources.NonNegativeFloatType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/NonNegativeIntType.cs b/src/HotChocolate/Core/src/Types.Scalars/NonNegativeIntType.cs index 7f4b70ba45a..197d55138df 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NonNegativeIntType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NonNegativeIntType.cs @@ -11,22 +11,22 @@ public class NonNegativeIntType : IntType /// /// Initializes a new instance of the class. /// - [ActivatorUtilitiesConstructor] - public NonNegativeIntType() - : this( - WellKnownScalarTypes.NonNegativeInt, - ScalarResources.NonNegativeIntType_Description) + public NonNegativeIntType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, 0, int.MaxValue, bind) { } /// /// Initializes a new instance of the class. /// - public NonNegativeIntType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, 0, int.MaxValue, bind) + [ActivatorUtilitiesConstructor] + public NonNegativeIntType() + : this( + WellKnownScalarTypes.NonNegativeInt, + ScalarResources.NonNegativeIntType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/NonPositiveFloatType.cs b/src/HotChocolate/Core/src/Types.Scalars/NonPositiveFloatType.cs index 2c58e348cf1..ee7bb982a77 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NonPositiveFloatType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NonPositiveFloatType.cs @@ -11,22 +11,22 @@ public class NonPositiveFloatType : FloatType /// /// Initializes a new instance of /// - [ActivatorUtilitiesConstructor] - public NonPositiveFloatType() - : this( - WellKnownScalarTypes.NonPositiveFloat, - ScalarResources.NonPositiveFloatType_Description) + public NonPositiveFloatType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, double.MinValue, 0, bind) { } /// /// Initializes a new instance of /// - public NonPositiveFloatType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, double.MinValue, 0, bind) + [ActivatorUtilitiesConstructor] + public NonPositiveFloatType() + : this( + WellKnownScalarTypes.NonPositiveFloat, + ScalarResources.NonPositiveFloatType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/NonPositiveIntType.cs b/src/HotChocolate/Core/src/Types.Scalars/NonPositiveIntType.cs index 5c1f0dd6355..37fc786d7f4 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/NonPositiveIntType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/NonPositiveIntType.cs @@ -11,22 +11,22 @@ public class NonPositiveIntType : IntType /// /// Initializes a new instance of /// - [ActivatorUtilitiesConstructor] - public NonPositiveIntType() - : this( - WellKnownScalarTypes.NonPositiveInt, - ScalarResources.NonPositiveIntType_Description) + public NonPositiveIntType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, int.MinValue, 0, bind) { } /// /// Initializes a new instance of /// - public NonPositiveIntType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, int.MinValue, 0, bind) + [ActivatorUtilitiesConstructor] + public NonPositiveIntType() + : this( + WellKnownScalarTypes.NonPositiveInt, + ScalarResources.NonPositiveIntType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/PhoneNumberType.cs b/src/HotChocolate/Core/src/Types.Scalars/PhoneNumberType.cs index 1169c904740..2f4406b0489 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/PhoneNumberType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/PhoneNumberType.cs @@ -30,17 +30,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public PhoneNumberType() - : this( - WellKnownScalarTypes.PhoneNumber, - ScalarResources.PhoneNumberType_Description) - { - } - /// /// Initializes a new instance of the /// @@ -56,6 +45,17 @@ public PhoneNumberType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public PhoneNumberType() + : this( + WellKnownScalarTypes.PhoneNumber, + ScalarResources.PhoneNumberType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/PortType.cs b/src/HotChocolate/Core/src/Types.Scalars/PortType.cs index 2d8a468205b..a63ed3c21bd 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/PortType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/PortType.cs @@ -14,22 +14,22 @@ public class PortType : IntType /// /// Initializes a new instance of the class. /// - [ActivatorUtilitiesConstructor] - public PortType() - : this( - WellKnownScalarTypes.Port, - ScalarResources.PortType_Description) + public PortType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, 0, 65535, bind) { } /// /// Initializes a new instance of the class. /// - public PortType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, 0, 65535, bind) + [ActivatorUtilitiesConstructor] + public PortType() + : this( + WellKnownScalarTypes.Port, + ScalarResources.PortType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/PositiveIntType.cs b/src/HotChocolate/Core/src/Types.Scalars/PositiveIntType.cs index be215bf51d0..97423ffa952 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/PositiveIntType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/PositiveIntType.cs @@ -11,22 +11,22 @@ public class PositiveIntType : IntType /// /// Initializes a new instance of the class. /// - [ActivatorUtilitiesConstructor] - public PositiveIntType() - : this( - WellKnownScalarTypes.PositiveInt, - ScalarResources.PositiveIntType_Description) + public PositiveIntType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, min: 1, bind: bind) { } /// /// Initializes a new instance of the class. /// - public PositiveIntType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, min: 1, bind: bind) + [ActivatorUtilitiesConstructor] + public PositiveIntType() + : this( + WellKnownScalarTypes.PositiveInt, + ScalarResources.PositiveIntType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs b/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs index f61b405a559..08c62225bfa 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/PostalCodeType.cs @@ -152,22 +152,22 @@ private static Regex CreateRegex(string pattern) /// /// Initializes a new instance of the class. /// - [ActivatorUtilitiesConstructor] - public PostalCodeType() - : this( - WellKnownScalarTypes.PostalCode, - ScalarResources.PostalCodeType_Description) + public PostalCodeType( + string name, + string? description = null, + BindingBehavior bind = BindingBehavior.Explicit) + : base(name, description, bind) { } /// /// Initializes a new instance of the class. /// - public PostalCodeType( - string name, - string? description = null, - BindingBehavior bind = BindingBehavior.Explicit) - : base(name, description, bind) + [ActivatorUtilitiesConstructor] + public PostalCodeType() + : this( + WellKnownScalarTypes.PostalCode, + ScalarResources.PostalCodeType_Description) { } diff --git a/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs b/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs index 5801de28708..a34b687614c 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/RgbType.cs @@ -30,17 +30,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public RgbType() - : this( - WellKnownScalarTypes.Rgb, - ScalarResources.RgbType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -56,6 +45,17 @@ public RgbType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public RgbType() + : this( + WellKnownScalarTypes.Rgb, + ScalarResources.RgbType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs b/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs index 447cdc0db4a..40b434e8604 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/RgbaType.cs @@ -28,17 +28,6 @@ private static Regex CreateRegex() TimeSpan.FromMilliseconds(DefaultRegexTimeoutInMs)); #endif - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public RgbaType() - : this( - WellKnownScalarTypes.Rgba, - ScalarResources.RgbaType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -54,6 +43,17 @@ public RgbaType( { } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public RgbaType() + : this( + WellKnownScalarTypes.Rgba, + ScalarResources.RgbaType_Description) + { + } + /// protected override SerializationException CreateParseLiteralError(IValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/SignedByteType.cs b/src/HotChocolate/Core/src/Types.Scalars/SignedByteType.cs index 284f4a3601c..7b526d715f2 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/SignedByteType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/SignedByteType.cs @@ -8,14 +8,6 @@ namespace HotChocolate.Types; /// public class SignedByteType : IntegerTypeBase { - [ActivatorUtilitiesConstructor] - public SignedByteType() - : this( - WellKnownScalarTypes.SignedByte, - ScalarResources.SignedByteType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -28,6 +20,17 @@ public SignedByteType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public SignedByteType() + : this( + WellKnownScalarTypes.SignedByte, + ScalarResources.SignedByteType_Description) + { + } + /// protected override bool IsInstanceOfType(sbyte runtimeValue) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/UnsignedIntType.cs b/src/HotChocolate/Core/src/Types.Scalars/UnsignedIntType.cs index 74f4eb878a5..f734734556e 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/UnsignedIntType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/UnsignedIntType.cs @@ -8,14 +8,6 @@ namespace HotChocolate.Types; /// public class UnsignedIntType : IntegerTypeBase { - [ActivatorUtilitiesConstructor] - public UnsignedIntType() - : this( - WellKnownScalarTypes.UnsignedInt, - ScalarResources.UnsignedIntType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -28,6 +20,17 @@ public UnsignedIntType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UnsignedIntType() + : this( + WellKnownScalarTypes.UnsignedInt, + ScalarResources.UnsignedIntType_Description) + { + } + /// protected override bool IsInstanceOfType(uint runtimeValue) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/UnsignedLongType.cs b/src/HotChocolate/Core/src/Types.Scalars/UnsignedLongType.cs index be8d6fc90f5..4d3b566069e 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/UnsignedLongType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/UnsignedLongType.cs @@ -8,17 +8,6 @@ namespace HotChocolate.Types; /// public class UnsignedLongType : IntegerTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public UnsignedLongType() - : this( - WellKnownScalarTypes.UnsignedLong, - ScalarResources.UnsignedLongType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -31,6 +20,17 @@ public UnsignedLongType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UnsignedLongType() + : this( + WellKnownScalarTypes.UnsignedLong, + ScalarResources.UnsignedLongType_Description) + { + } + /// protected override bool IsInstanceOfType(ulong runtimeValue) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/UnsignedShortType.cs b/src/HotChocolate/Core/src/Types.Scalars/UnsignedShortType.cs index dd53f250fc6..7d6b823f2fc 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/UnsignedShortType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/UnsignedShortType.cs @@ -8,14 +8,6 @@ namespace HotChocolate.Types; /// public class UnsignedShortType : IntegerTypeBase { - [ActivatorUtilitiesConstructor] - public UnsignedShortType() - : this( - WellKnownScalarTypes.UnsignedShort, - ScalarResources.UnsignedShortType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -28,6 +20,17 @@ public UnsignedShortType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UnsignedShortType() + : this( + WellKnownScalarTypes.UnsignedShort, + ScalarResources.UnsignedShortType_Description) + { + } + /// protected override bool IsInstanceOfType(ushort runtimeValue) { diff --git a/src/HotChocolate/Core/src/Types.Scalars/UtcOffsetType.cs b/src/HotChocolate/Core/src/Types.Scalars/UtcOffsetType.cs index 9849cce9b3c..1b054a53a9d 100644 --- a/src/HotChocolate/Core/src/Types.Scalars/UtcOffsetType.cs +++ b/src/HotChocolate/Core/src/Types.Scalars/UtcOffsetType.cs @@ -11,17 +11,6 @@ namespace HotChocolate.Types; /// public class UtcOffsetType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public UtcOffsetType() - : this( - WellKnownScalarTypes.UtcOffset, - ScalarResources.UtcOffsetType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -34,6 +23,17 @@ public UtcOffsetType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UtcOffsetType() + : this( + WellKnownScalarTypes.UtcOffset, + ScalarResources.UtcOffsetType_Description) + { + } + /// public override IValueNode ParseResult(object? resultValue) { diff --git a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs index f58add70bda..ce5ab6fbb39 100644 --- a/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/DirectiveType~1.cs @@ -12,15 +12,15 @@ public class DirectiveType : DirectiveType where TDirective : class { private Action>? _configure; - [ActivatorUtilitiesConstructor] - public DirectiveType() + public DirectiveType(Action> configure) { - _configure = Configure; + _configure = configure ?? throw new ArgumentNullException(nameof(configure)); } - public DirectiveType(Action> configure) + [ActivatorUtilitiesConstructor] + public DirectiveType() { - _configure = configure ?? throw new ArgumentNullException(nameof(configure)); + _configure = Configure; } protected override DirectiveTypeDefinition CreateDefinition( diff --git a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs index 6778719e3a9..41c46c3ca8a 100644 --- a/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/EnumType~1.cs @@ -30,15 +30,6 @@ public class EnumType : EnumType, IEnumType { private Action>? _configure; - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public EnumType() - { - _configure = Configure; - } - /// /// Initializes a new instance of . /// @@ -51,6 +42,15 @@ public EnumType(Action> configure) ?? throw new ArgumentNullException(nameof(configure)); } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public EnumType() + { + _configure = Configure; + } + /// public bool TryGetRuntimeValue(string name, [NotNullWhen(true)] out T runtimeValue) { diff --git a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs index 972ac0b2e0b..3fc92ca6955 100644 --- a/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InputObjectType~1.cs @@ -11,15 +11,15 @@ public class InputObjectType : InputObjectType { private Action>? _configure; - [ActivatorUtilitiesConstructor] - public InputObjectType() + public InputObjectType(Action> configure) { - _configure = Configure; + _configure = configure ?? throw new ArgumentNullException(nameof(configure)); } - public InputObjectType(Action> configure) + [ActivatorUtilitiesConstructor] + public InputObjectType() { - _configure = configure ?? throw new ArgumentNullException(nameof(configure)); + _configure = Configure; } protected override InputObjectTypeDefinition CreateDefinition( diff --git a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs index 2c28923177e..f64d9da2519 100644 --- a/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/InterfaceType~1.cs @@ -11,13 +11,13 @@ public class InterfaceType : InterfaceType { private Action>? _configure; + public InterfaceType(Action> configure) => + _configure = configure ?? throw new ArgumentNullException(nameof(configure)); + [ActivatorUtilitiesConstructor] public InterfaceType() => _configure = Configure; - public InterfaceType(Action> configure) => - _configure = configure ?? throw new ArgumentNullException(nameof(configure)); - protected override InterfaceTypeDefinition CreateDefinition(ITypeDiscoveryContext context) { var descriptor = InterfaceTypeDescriptor.New(context.DescriptorContext); diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs index 16b65c95f38..fee8ffd3829 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectTypeExtension~1.cs @@ -22,21 +22,21 @@ public class ObjectTypeExtension : ObjectTypeExtension private Action>? _configure; /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - [ActivatorUtilitiesConstructor] - public ObjectTypeExtension() + public ObjectTypeExtension(Action> configure) { - _configure = Configure; + _configure = configure + ?? throw new ArgumentNullException(nameof(configure)); } /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// - public ObjectTypeExtension(Action> configure) + [ActivatorUtilitiesConstructor] + public ObjectTypeExtension() { - _configure = configure - ?? throw new ArgumentNullException(nameof(configure)); + _configure = Configure; } protected override ObjectTypeDefinition CreateDefinition( diff --git a/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs b/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs index bc10310178f..33526225ab6 100644 --- a/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/ObjectType~1.cs @@ -32,15 +32,15 @@ public class ObjectType : ObjectType /// /// Initializes a new instance of . /// - [ActivatorUtilitiesConstructor] - public ObjectType() - => _configure = Configure; + public ObjectType(Action> configure) + => _configure = configure ?? throw new ArgumentNullException(nameof(configure)); /// /// Initializes a new instance of . /// - public ObjectType(Action> configure) - => _configure = configure ?? throw new ArgumentNullException(nameof(configure)); + [ActivatorUtilitiesConstructor] + public ObjectType() + => _configure = Configure; protected override ObjectTypeDefinition CreateDefinition( ITypeDiscoveryContext context) diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs index b1f15e3c6c6..1e2c77cfa12 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/AnyType.cs @@ -17,14 +17,6 @@ public class AnyType : ScalarType private readonly ObjectValueToDictionaryConverter _objectValueToDictConverter = new(); private ObjectToDictionaryConverter _objectToDictConverter = default!; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public AnyType() : this(ScalarNames.Any) - { - } - /// /// Initializes a new instance of the class. /// @@ -37,6 +29,14 @@ public AnyType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public AnyType() : this(ScalarNames.Any) + { + } + public override Type RuntimeType => typeof(object); protected override void OnCompleteType( diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/BooleanType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/BooleanType.cs index f27f36df095..4fbe0c4a3e8 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/BooleanType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/BooleanType.cs @@ -13,18 +13,6 @@ namespace HotChocolate.Types; [SpecScalar] public class BooleanType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public BooleanType() - : this( - ScalarNames.Boolean, - TypeResources.BooleanType_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -36,6 +24,18 @@ public BooleanType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public BooleanType() + : this( + ScalarNames.Boolean, + TypeResources.BooleanType_Description, + BindingBehavior.Implicit) + { + } protected override bool ParseLiteral(BooleanValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/ByteArrayType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/ByteArrayType.cs index f3c768ab08c..aa04d37c234 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/ByteArrayType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/ByteArrayType.cs @@ -8,15 +8,6 @@ namespace HotChocolate.Types; public class ByteArrayType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public ByteArrayType() - : this(ScalarNames.ByteArray, bind: BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -28,6 +19,15 @@ public ByteArrayType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public ByteArrayType() + : this(ScalarNames.ByteArray, bind: BindingBehavior.Implicit) + { + } protected override byte[] ParseLiteral(StringValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/ByteType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/ByteType.cs index cc7b47b6d06..8cf95fb9a7e 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/ByteType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/ByteType.cs @@ -7,15 +7,6 @@ namespace HotChocolate.Types; public class ByteType : IntegerTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public ByteType() - : this(byte.MinValue, byte.MaxValue) - { - } - /// /// Initializes a new instance of the class. /// @@ -43,6 +34,15 @@ public ByteType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public ByteType() + : this(byte.MinValue, byte.MaxValue) + { + } + protected override byte ParseLiteral(IntValueNode valueSyntax) => valueSyntax.ToByte(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs index 7074eb587e7..d6ca3b81797 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs @@ -20,18 +20,6 @@ public class DateTimeType : ScalarType private const string _localFormat = "yyyy-MM-ddTHH\\:mm\\:ss.fffzzz"; private const string _specifiedBy = "https://www.graphql-scalars.com/date-time"; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public DateTimeType() - : this( - ScalarNames.DateTime, - TypeResources.DateTimeType_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -45,6 +33,18 @@ public DateTimeType( SpecifiedBy = new Uri(_specifiedBy); } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public DateTimeType() + : this( + ScalarNames.DateTime, + TypeResources.DateTimeType_Description, + BindingBehavior.Implicit) + { + } + protected override DateTimeOffset ParseLiteral(StringValueNode valueSyntax) { if (TryDeserializeFromString(valueSyntax.Value, out var value)) diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/DateType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/DateType.cs index c5e5485c238..912389526aa 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/DateType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/DateType.cs @@ -12,14 +12,6 @@ public class DateType : ScalarType { private const string _dateFormat = "yyyy-MM-dd"; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public DateType() : this(ScalarNames.Date, TypeResources.DateType_Description) - { - } - /// /// Initializes a new instance of the class. /// @@ -32,6 +24,14 @@ public DateType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public DateType() : this(ScalarNames.Date, TypeResources.DateType_Description) + { + } + protected override DateTime ParseLiteral(StringValueNode valueSyntax) { if (TryDeserializeFromString(valueSyntax.Value, out var value)) diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/DecimalType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/DecimalType.cs index 29dd3827dc5..07cfe07b095 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/DecimalType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/DecimalType.cs @@ -7,15 +7,6 @@ namespace HotChocolate.Types; public class DecimalType : FloatTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public DecimalType() - : this(decimal.MinValue, decimal.MaxValue) - { - } - /// /// Initializes a new instance of the class. /// @@ -42,6 +33,15 @@ public DecimalType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public DecimalType() + : this(decimal.MinValue, decimal.MaxValue) + { + } protected override decimal ParseLiteral(IFloatValueLiteral valueSyntax) => valueSyntax.ToDecimal(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/FloatType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/FloatType.cs index 93a6faef292..fd64de3224a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/FloatType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/FloatType.cs @@ -16,16 +16,6 @@ namespace HotChocolate.Types; [SpecScalar] public class FloatType : FloatTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public FloatType() - : this(double.MinValue, double.MaxValue) - { - - } - /// /// Initializes a new instance of the class. /// @@ -52,6 +42,16 @@ public FloatType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public FloatType() + : this(double.MinValue, double.MaxValue) + { + + } protected override double ParseLiteral(IFloatValueLiteral valueSyntax) => valueSyntax.ToDouble(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/IdType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/IdType.cs index dd603bf7d57..faf73259a22 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/IdType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/IdType.cs @@ -18,15 +18,6 @@ namespace HotChocolate.Types; [SpecScalar] public class IdType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public IdType() : this(ScalarNames.ID, TypeResources.IdType_Description) - { - - } - /// /// Initializes a new instance of the class. /// @@ -38,6 +29,15 @@ public IdType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public IdType() : this(ScalarNames.ID, TypeResources.IdType_Description) + { + + } public override bool IsInstanceOfType(IValueNode literal) { diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/IntType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/IntType.cs index 2df538fef32..a1e7070dd20 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/IntType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/IntType.cs @@ -15,15 +15,6 @@ namespace HotChocolate.Types; [SpecScalar] public class IntType : IntegerTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public IntType() - : this(int.MinValue, int.MaxValue) - { - } - /// /// Initializes a new instance of the class. /// @@ -50,6 +41,15 @@ public IntType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public IntType() + : this(int.MinValue, int.MaxValue) + { + } protected override int ParseLiteral(IntValueNode valueSyntax) => valueSyntax.ToInt32(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/JsonType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/JsonType.cs index 5c554ec23ad..34192585f45 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/JsonType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/JsonType.cs @@ -21,15 +21,15 @@ public sealed class JsonType : ScalarType /// /// Initializes a new instance of . /// - [ActivatorUtilitiesConstructor] - public JsonType() - : base(ScalarNames.JSON, BindingBehavior.Implicit) { } - + public JsonType(string name, BindingBehavior bind = BindingBehavior.Explicit) + : base(name, bind) { } + /// /// Initializes a new instance of . /// - public JsonType(string name, BindingBehavior bind = BindingBehavior.Explicit) - : base(name, bind) { } + [ActivatorUtilitiesConstructor] + public JsonType() + : base(ScalarNames.JSON, BindingBehavior.Implicit) { } /// /// Defines if the specified can be handled by the JSON scalar. diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/LongType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/LongType.cs index f9a729b71bf..b58a3e43710 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/LongType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/LongType.cs @@ -8,15 +8,6 @@ namespace HotChocolate.Types; public class LongType : IntegerTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public LongType() - : this(long.MinValue, long.MaxValue) - { - } - /// /// Initializes a new instance of the class. /// @@ -43,6 +34,15 @@ public LongType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public LongType() + : this(long.MinValue, long.MaxValue) + { + } protected override long ParseLiteral(IntValueNode valueSyntax) => valueSyntax.ToInt64(); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/MultiplierPathType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/MultiplierPathType.cs index 7371dc97f16..d17cbee5a9f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/MultiplierPathType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/MultiplierPathType.cs @@ -12,18 +12,6 @@ namespace HotChocolate.Types; public class MultiplierPathType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public MultiplierPathType() - : this( - ScalarNames.MultiplierPath, - TypeResources.MultiplierPathType_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -36,6 +24,18 @@ public MultiplierPathType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public MultiplierPathType() + : this( + ScalarNames.MultiplierPath, + TypeResources.MultiplierPathType_Description, + BindingBehavior.Implicit) + { + } + protected override bool IsInstanceOfType(StringValueNode valueSyntax) { return MultiplierPathString.IsValidPath(valueSyntax.AsSpan()); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/ShortType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/ShortType.cs index 746906a0c90..aad6113362c 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/ShortType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/ShortType.cs @@ -7,14 +7,6 @@ namespace HotChocolate.Types; public class ShortType : IntegerTypeBase { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public ShortType() : this(short.MinValue, short.MaxValue) - { - } - /// /// Initializes a new instance of the class. /// @@ -41,6 +33,14 @@ public ShortType( { Description = description; } + + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public ShortType() : this(short.MinValue, short.MaxValue) + { + } protected override short ParseLiteral(IntValueNode valueSyntax) { diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/StringType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/StringType.cs index 796258462cf..9015b88f96a 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/StringType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/StringType.cs @@ -15,18 +15,6 @@ namespace HotChocolate.Types; [SpecScalar] public class StringType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public StringType() - : this( - ScalarNames.String, - TypeResources.StringType_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -39,6 +27,18 @@ public StringType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public StringType() + : this( + ScalarNames.String, + TypeResources.StringType_Description, + BindingBehavior.Implicit) + { + } + protected override string ParseLiteral(StringValueNode valueSyntax) => valueSyntax.Value; diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/TimeSpanType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/TimeSpanType.cs index 5047acb71ef..a6ba76065f4 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/TimeSpanType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/TimeSpanType.cs @@ -16,12 +16,6 @@ public class TimeSpanType { private readonly TimeSpanFormat _format; - [ActivatorUtilitiesConstructor] - public TimeSpanType() - : this(ScalarNames.TimeSpan, TypeResources.TimeSpanType_Description) - { - } - public TimeSpanType( TimeSpanFormat format = TimeSpanFormat.Iso8601, BindingBehavior bind = BindingBehavior.Implicit) @@ -40,6 +34,12 @@ public TimeSpanType( Description = description; } + [ActivatorUtilitiesConstructor] + public TimeSpanType() + : this(ScalarNames.TimeSpan, TypeResources.TimeSpanType_Description) + { + } + protected override TimeSpan ParseLiteral(StringValueNode valueSyntax) { if (TryDeserializeFromString(valueSyntax.Value, _format, out var value) && diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/UrlType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/UrlType.cs index 59eb3dad968..2d908c2a912 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/UrlType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/UrlType.cs @@ -11,16 +11,6 @@ public class UrlType : ScalarType { private const string _specifiedBy = "https://tools.ietf.org/html/rfc3986"; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public UrlType() - : this(ScalarNames.URL, bind: BindingBehavior.Implicit) - { - SpecifiedBy = new Uri(_specifiedBy); - } - /// /// Initializes a new instance of the class. /// @@ -33,6 +23,16 @@ public UrlType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UrlType() + : this(ScalarNames.URL, bind: BindingBehavior.Implicit) + { + SpecifiedBy = new Uri(_specifiedBy); + } + protected override bool IsInstanceOfType(StringValueNode valueSyntax) { return TryParseUri(valueSyntax.Value, out _); diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/UuidType.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/UuidType.cs index 331e15dabcd..4c985e3a66f 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/UuidType.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/UuidType.cs @@ -14,14 +14,6 @@ public class UuidType : ScalarType private readonly string _format; private readonly bool _enforceFormat; - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public UuidType() : this('\0') - { - } - /// /// Initializes a new instance of the class. /// @@ -87,6 +79,14 @@ public UuidType( _enforceFormat = enforceFormat; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public UuidType() : this('\0') + { + } + protected override bool IsInstanceOfType(StringValueNode valueSyntax) { if (_enforceFormat) diff --git a/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs b/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs index 65ae747466e..60ca1e09925 100644 --- a/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs +++ b/src/HotChocolate/Core/src/Types/Types/UnionType~1.cs @@ -11,18 +11,18 @@ public class UnionType : UnionType { private Action? _configure; - [ActivatorUtilitiesConstructor] - public UnionType() - { - _configure = Configure; - } - public UnionType(Action configure) { _configure = configure ?? throw new ArgumentNullException(nameof(configure)); } + [ActivatorUtilitiesConstructor] + public UnionType() + { + _configure = Configure; + } + protected override UnionTypeDefinition CreateDefinition(ITypeDiscoveryContext context) { var descriptor = diff --git a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs index b7f068d318a..57a30709dd4 100644 --- a/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Filters/FilterInputType`1.cs @@ -9,18 +9,18 @@ public class FilterInputType : FilterInputType { private Action>? _configure; - [ActivatorUtilitiesConstructor] - public FilterInputType() - { - _configure = Configure; - } - public FilterInputType(Action> configure) { _configure = configure ?? throw new ArgumentNullException(nameof(configure)); } + [ActivatorUtilitiesConstructor] + public FilterInputType() + { + _configure = Configure; + } + protected override InputObjectTypeDefinition CreateDefinition( ITypeDiscoveryContext context) { diff --git a/src/HotChocolate/Data/src/Data/Filters/Types/IdOperationFilterInputType.cs b/src/HotChocolate/Data/src/Data/Filters/Types/IdOperationFilterInputType.cs index c6e14120d39..7ae1a0c1a06 100644 --- a/src/HotChocolate/Data/src/Data/Filters/Types/IdOperationFilterInputType.cs +++ b/src/HotChocolate/Data/src/Data/Filters/Types/IdOperationFilterInputType.cs @@ -8,13 +8,13 @@ public class IdOperationFilterInputType : FilterInputType , IComparableOperationFilterInputType { - [ActivatorUtilitiesConstructor] - public IdOperationFilterInputType() + public IdOperationFilterInputType(Action configure) + : base(configure) { } - public IdOperationFilterInputType(Action configure) - : base(configure) + [ActivatorUtilitiesConstructor] + public IdOperationFilterInputType() { } diff --git a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs index a0c043d42bd..c0958850ee0 100644 --- a/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs +++ b/src/HotChocolate/Data/src/Data/Sorting/SortInputType`1.cs @@ -9,18 +9,18 @@ public class SortInputType : SortInputType { private Action>? _configure; - [ActivatorUtilitiesConstructor] - public SortInputType() - { - _configure = Configure; - } - public SortInputType(Action> configure) { _configure = configure ?? throw new ArgumentNullException(nameof(configure)); } + [ActivatorUtilitiesConstructor] + public SortInputType() + { + _configure = Configure; + } + protected override InputObjectTypeDefinition CreateDefinition( ITypeDiscoveryContext context) { diff --git a/src/HotChocolate/Marten/src/Data/Filtering/MartenQueryableFilterProvider.cs b/src/HotChocolate/Marten/src/Data/Filtering/MartenQueryableFilterProvider.cs index 7d9b93a7ce1..fc9849535f8 100644 --- a/src/HotChocolate/Marten/src/Data/Filtering/MartenQueryableFilterProvider.cs +++ b/src/HotChocolate/Marten/src/Data/Filtering/MartenQueryableFilterProvider.cs @@ -10,14 +10,6 @@ namespace HotChocolate.Data.Marten.Filtering; /// public class MartenQueryableFilterProvider : QueryableFilterProvider { - /// - /// Initializes a new instance of . - /// - [ActivatorUtilitiesConstructor] - public MartenQueryableFilterProvider() - { - } - /// /// Initializes a new instance of . /// @@ -30,6 +22,14 @@ public MartenQueryableFilterProvider( { } + /// + /// Initializes a new instance of . + /// + [ActivatorUtilitiesConstructor] + public MartenQueryableFilterProvider() + { + } + /// protected override void Configure(IFilterProviderDescriptor descriptor) { diff --git a/src/HotChocolate/MongoDb/src/Types/BsonType.cs b/src/HotChocolate/MongoDb/src/Types/BsonType.cs index 99e52d109e5..2f42fb262aa 100644 --- a/src/HotChocolate/MongoDb/src/Types/BsonType.cs +++ b/src/HotChocolate/MongoDb/src/Types/BsonType.cs @@ -15,18 +15,6 @@ namespace HotChocolate.Types.MongoDb; /// public class BsonType : ScalarType { - /// - /// Initializes a new instance of the class. - /// - [ActivatorUtilitiesConstructor] - public BsonType() - : this( - MongoDbScalarNames.Bson, - MongoDbTypesResources.Bson_Type_Description, - BindingBehavior.Implicit) - { - } - /// /// Initializes a new instance of the class. /// @@ -40,6 +28,18 @@ public BsonType( Description = description; } + /// + /// Initializes a new instance of the class. + /// + [ActivatorUtilitiesConstructor] + public BsonType() + : this( + MongoDbScalarNames.Bson, + MongoDbTypesResources.Bson_Type_Description, + BindingBehavior.Implicit) + { + } + /// public override Type RuntimeType => typeof(BsonValue); diff --git a/src/HotChocolate/Spatial/src/Types/GeometryType.cs b/src/HotChocolate/Spatial/src/Types/GeometryType.cs index 150d417b5bb..624f6d7f6ec 100644 --- a/src/HotChocolate/Spatial/src/Types/GeometryType.cs +++ b/src/HotChocolate/Spatial/src/Types/GeometryType.cs @@ -11,11 +11,6 @@ public sealed class GeometryType , IGeoJsonObjectType , IGeoJsonInputType { - [ActivatorUtilitiesConstructor] - public GeometryType() : base(GeometryTypeName) - { - } - public GeometryType( string name, BindingBehavior bind = BindingBehavior.Explicit) @@ -23,6 +18,11 @@ public GeometryType( { } + [ActivatorUtilitiesConstructor] + public GeometryType() : base(GeometryTypeName) + { + } + public override object? Deserialize(object? resultValue) => GeoJsonGeometrySerializer.Default.Deserialize(this, resultValue);