Fix datetime null warning when compiling.

Removing the x-is-value-type which was a buggy and old version of the new x-csharp-value-type that work for every type.
This commit is contained in:
Jean-François Côté 2023-05-16 14:35:31 -04:00
parent 1561c33966
commit d157245efa
6 changed files with 39 additions and 39 deletions

View File

@ -104,14 +104,14 @@ namespace {{modelPackage}}
return {{#vars}}{{^isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&{{/vendorExtensions.x-csharp-value-type}}
{{name}}.Equals(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&
other.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
{{/vendorExtensions.x-csharp-value-type}}{{name}}.SequenceEqual(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
}
@ -126,7 +126,7 @@ namespace {{modelPackage}}
var hashCode = 41;
// Suitable nullity checks etc, of course :)
{{#vars}}
{{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}if ({{name}} != null){{/vendorExtensions.x-csharp-value-type}}
hashCode = hashCode * 59 + {{name}}.GetHashCode();
{{/vars}}
return hashCode;

View File

@ -72,7 +72,7 @@ namespace {{modelPackage}}
[MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}}
[MaxLength({{.}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}
[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}
[DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}true{{/vendorExtensions.x-is-value-type}}{{^vendorExtensions.x-is-value-type}}false{{/vendorExtensions.x-is-value-type}}{{/isNullable}})]
[DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-csharp-value-type}}true{{/vendorExtensions.x-csharp-value-type}}{{^vendorExtensions.x-csharp-value-type}}false{{/vendorExtensions.x-csharp-value-type}}{{/isNullable}})]
{{#isEnum}}
public {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}
{{/isEnum}}
@ -144,14 +144,14 @@ namespace {{modelPackage}}
return {{#vars}}{{^isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&{{/vendorExtensions.x-csharp-value-type}}
{{name}}.Equals(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&
other.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
{{/vendorExtensions.x-csharp-value-type}}{{name}}.SequenceEqual(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
}
@ -166,7 +166,7 @@ namespace {{modelPackage}}
var hashCode = 41;
// Suitable nullity checks etc, of course :)
{{#vars}}
{{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}if ({{name}} != null){{/vendorExtensions.x-csharp-value-type}}
hashCode = hashCode * 59 + {{name}}.GetHashCode();
{{/vars}}
return hashCode;

View File

@ -109,14 +109,14 @@ namespace {{modelPackage}}
return {{#vars}}{{^isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&{{/vendorExtensions.x-csharp-value-type}}
{{name}}.Equals(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
{{name}} == other.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&
other.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}})
{{/vendorExtensions.x-csharp-value-type}}{{name}}.SequenceEqual(other.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}};
}
@ -131,7 +131,7 @@ namespace {{modelPackage}}
var hashCode = 41;
// Suitable nullity checks etc, of course :)
{{#vars}}
{{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}if ({{name}} != null){{/vendorExtensions.x-csharp-value-type}}
hashCode = hashCode * 59 + {{name}}.GetHashCode();
{{/vars}}
return hashCode;

View File

@ -320,19 +320,19 @@
return {{#vars}}{{#parent}}base.Equals(input) && {{/parent}}{{^isContainer}}
(
this.{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}
(this.{{name}} != null &&
this.{{name}}.Equals(input.{{name}}))
{{/vendorExtensions.x-is-value-type}}
{{#vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
this.{{name}}.Equals(input.{{name}})
{{/vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
this.{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}this.{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}this.{{name}} != null &&
input.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
{{/vendorExtensions.x-csharp-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
{{#isAdditionalPropertiesTrue}}
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
@ -355,13 +355,13 @@
int hashCode = 41;
{{/parent}}
{{#vars}}
{{^vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}
if (this.{{name}} != null)
hashCode = hashCode * 59 + this.{{name}}.GetHashCode();
{{/vendorExtensions.x-is-value-type}}
{{#vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
hashCode = hashCode * 59 + this.{{name}}.GetHashCode();
{{/vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
if (this.AdditionalProperties != null)

View File

@ -259,19 +259,19 @@
return {{#parent}}base.Equals(input) && {{/parent}}{{#readOnlyVars}}{{^isInherited}}{{^isContainer}}
(
{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}
({{name}} != null &&
{{name}}.Equals(input.{{name}}))
{{/vendorExtensions.x-is-value-type}}
{{#vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
{{name}}.Equals(input.{{name}})
{{/vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}{{name}} != null &&
input.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(input.{{name}})
{{/vendorExtensions.x-csharp-value-type}}{{name}}.SequenceEqual(input.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/isInherited}}{{/readOnlyVars}}{{^readOnlyVars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/readOnlyVars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
{{#isAdditionalPropertiesTrue}}
{{^parentModel}}

View File

@ -361,19 +361,19 @@
return {{#vars}}{{#parent}}base.Equals(input) && {{/parent}}{{^isContainer}}
(
this.{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}
(this.{{name}} != null &&
this.{{name}}.Equals(input.{{name}}))
{{/vendorExtensions.x-is-value-type}}
{{#vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
this.{{name}}.Equals(input.{{name}})
{{/vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
(
this.{{name}} == input.{{name}} ||
{{^vendorExtensions.x-is-value-type}}this.{{name}} != null &&
{{^vendorExtensions.x-csharp-value-type}}this.{{name}} != null &&
input.{{name}} != null &&
{{/vendorExtensions.x-is-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
{{/vendorExtensions.x-csharp-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
{{#isAdditionalPropertiesTrue}}
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
@ -396,15 +396,15 @@
int hashCode = 41;
{{/parent}}
{{#vars}}
{{^vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-csharp-value-type}}
if (this.{{name}} != null)
{
hashCode = (hashCode * 59) + this.{{name}}.GetHashCode();
}
{{/vendorExtensions.x-is-value-type}}
{{#vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{#vendorExtensions.x-csharp-value-type}}
hashCode = (hashCode * 59) + this.{{name}}.GetHashCode();
{{/vendorExtensions.x-is-value-type}}
{{/vendorExtensions.x-csharp-value-type}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
if (this.AdditionalProperties != null)