diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 911da61e..ad8f7554 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,6 +42,12 @@ stages: - job: Build steps: + - task: UseDotNet@2 + displayName: 'Use .NET SDK 8.0.x' + inputs: + packageType: 'sdk' + version: '8.0.x' + - task: NuGetToolInstaller@0 inputs: versionSpec: '>=5.2.0' @@ -57,6 +63,7 @@ stages: solution: '$(sln)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' + msbuildArgs: '/p:DeployExtension=false' - task: DotNetCoreCLI@2 displayName: 'Pack Microsoft.OData.Cli package' diff --git a/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.cs b/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.cs index 8f70adb8..8fb77760 100644 --- a/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.cs +++ b/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.cs @@ -1690,10 +1690,10 @@ public override int GetHashCode() internal abstract string GeometryMultiPolygonTypeName { get; } internal abstract string GeometryMultiLineStringTypeName { get; } internal abstract string GeometryMultiPointTypeName { get; } - internal abstract string DateTypeName { get; } + internal abstract string DateOnlyTypeName { get; } internal abstract string DateTimeOffsetTypeName { get; } internal abstract string DurationTypeName { get; } - internal abstract string TimeOfDayTypeName { get; } + internal abstract string TimeOnlyTypeName { get; } internal abstract string XmlConvertClassName { get; } internal abstract string EnumTypeName { get; } internal abstract string DictionaryInterfaceName { get; } @@ -4038,8 +4038,8 @@ internal static string GetPropertyInitializationValue(IEdmProperty property, boo } else if (valueClrType.Equals(clientTemplate.GuidTypeName) | valueClrType.Equals(clientTemplate.DateTimeOffsetTypeName) - | valueClrType.Equals(clientTemplate.DateTypeName) - | valueClrType.Equals(clientTemplate.TimeOfDayTypeName)) + | valueClrType.Equals(clientTemplate.DateOnlyTypeName) + | valueClrType.Equals(clientTemplate.TimeOnlyTypeName)) { defaultValue = valueClrType + ".Parse(\"" + defaultValue + "\")"; } @@ -4219,11 +4219,11 @@ internal static string GetClrTypeName(IEdmPrimitiveType edmPrimitiveType, ODataC } else if (kind== EdmPrimitiveTypeKind.Date) { - type= clientTemplate.DateTypeName; + type= clientTemplate.DateOnlyTypeName; } else if (kind== EdmPrimitiveTypeKind.TimeOfDay) { - type= clientTemplate.TimeOfDayTypeName; + type= clientTemplate.TimeOnlyTypeName; } else { @@ -4298,10 +4298,10 @@ public ODataClientCSharpTemplate(CodeGenerationContext context) internal override string GeometryMultiPolygonTypeName { get { return "global::Microsoft.Spatial.GeometryMultiPolygon"; } } internal override string GeometryMultiLineStringTypeName { get { return "global::Microsoft.Spatial.GeometryMultiLineString"; } } internal override string GeometryMultiPointTypeName { get { return "global::Microsoft.Spatial.GeometryMultiPoint"; } } - internal override string DateTypeName { get { return "global::Microsoft.OData.Edm.Date"; } } + internal override string DateOnlyTypeName { get { return "global::System.DateOnly"; } } internal override string DateTimeOffsetTypeName { get { return "global::System.DateTimeOffset"; } } internal override string DurationTypeName { get { return "global::System.TimeSpan"; } } - internal override string TimeOfDayTypeName { get { return "global::Microsoft.OData.Edm.TimeOfDay"; } } + internal override string TimeOnlyTypeName { get { return "global::System.TimeOnly"; } } internal override string XmlConvertClassName { get { return "global::System.Xml.XmlConvert"; } } internal override string EnumTypeName { get { return "global::System.Enum"; } } internal override string DictionaryInterfaceName { get { return "global::System.Collections.Generic.IDictionary<{0}, {1}>"; } } @@ -6441,10 +6441,10 @@ public ODataClientVBTemplate(CodeGenerationContext context) internal override string GeometryMultiPolygonTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiPolygon"; } } internal override string GeometryMultiLineStringTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiLineString"; } } internal override string GeometryMultiPointTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiPoint"; } } - internal override string DateTypeName { get { return "Global.Microsoft.OData.Edm.Date"; } } + internal override string DateOnlyTypeName { get { return "Global.System.DateOnly"; } } internal override string DateTimeOffsetTypeName { get { return "Global.System.DateTimeOffset"; } } internal override string DurationTypeName { get { return "Global.System.TimeSpan"; } } - internal override string TimeOfDayTypeName { get { return "Global.Microsoft.OData.Edm.TimeOfDay"; } } + internal override string TimeOnlyTypeName { get { return "Global.System.TimeOnly"; } } internal override string XmlConvertClassName { get { return "Global.System.Xml.XmlConvert"; } } internal override string EnumTypeName { get { return "Global.System.Enum"; } } internal override string DictionaryInterfaceName { get { return "Global.System.Collections.Generic.IDictionary(Of {0}, {1})"; } } diff --git a/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.ttinclude b/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.ttinclude index f50826fe..6fc9ea21 100644 --- a/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.ttinclude +++ b/src/Microsoft.OData.CodeGen/Templates/ODataT4CodeGenerator.ttinclude @@ -1547,10 +1547,10 @@ public abstract class ODataClientTemplate : TemplateBase internal abstract string GeometryMultiPolygonTypeName { get; } internal abstract string GeometryMultiLineStringTypeName { get; } internal abstract string GeometryMultiPointTypeName { get; } - internal abstract string DateTypeName { get; } + internal abstract string DateOnlyTypeName { get; } internal abstract string DateTimeOffsetTypeName { get; } internal abstract string DurationTypeName { get; } - internal abstract string TimeOfDayTypeName { get; } + internal abstract string TimeOnlyTypeName { get; } internal abstract string XmlConvertClassName { get; } internal abstract string EnumTypeName { get; } internal abstract string DictionaryInterfaceName { get; } @@ -3895,8 +3895,8 @@ internal static class Utils } else if (valueClrType.Equals(clientTemplate.GuidTypeName) | valueClrType.Equals(clientTemplate.DateTimeOffsetTypeName) - | valueClrType.Equals(clientTemplate.DateTypeName) - | valueClrType.Equals(clientTemplate.TimeOfDayTypeName)) + | valueClrType.Equals(clientTemplate.DateOnlyTypeName) + | valueClrType.Equals(clientTemplate.TimeOnlyTypeName)) { defaultValue = valueClrType + ".Parse(\"" + defaultValue + "\")"; } @@ -4076,11 +4076,11 @@ internal static class Utils } else if (kind== EdmPrimitiveTypeKind.Date) { - type= clientTemplate.DateTypeName; + type= clientTemplate.DateOnlyTypeName; } else if (kind== EdmPrimitiveTypeKind.TimeOfDay) { - type= clientTemplate.TimeOfDayTypeName; + type= clientTemplate.TimeOnlyTypeName; } else { @@ -4155,10 +4155,10 @@ public sealed class ODataClientCSharpTemplate : ODataClientTemplate internal override string GeometryMultiPolygonTypeName { get { return "global::Microsoft.Spatial.GeometryMultiPolygon"; } } internal override string GeometryMultiLineStringTypeName { get { return "global::Microsoft.Spatial.GeometryMultiLineString"; } } internal override string GeometryMultiPointTypeName { get { return "global::Microsoft.Spatial.GeometryMultiPoint"; } } - internal override string DateTypeName { get { return "global::Microsoft.OData.Edm.Date"; } } + internal override string DateOnlyTypeName { get { return "global::System.DateOnly"; } } internal override string DateTimeOffsetTypeName { get { return "global::System.DateTimeOffset"; } } internal override string DurationTypeName { get { return "global::System.TimeSpan"; } } - internal override string TimeOfDayTypeName { get { return "global::Microsoft.OData.Edm.TimeOfDay"; } } + internal override string TimeOnlyTypeName { get { return "global::System.TimeOnly"; } } internal override string XmlConvertClassName { get { return "global::System.Xml.XmlConvert"; } } internal override string EnumTypeName { get { return "global::System.Enum"; } } internal override string DictionaryInterfaceName { get { return "global::System.Collections.Generic.IDictionary<{0}, {1}>"; } } @@ -5355,10 +5355,10 @@ public sealed class ODataClientVBTemplate : ODataClientTemplate internal override string GeometryMultiPolygonTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiPolygon"; } } internal override string GeometryMultiLineStringTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiLineString"; } } internal override string GeometryMultiPointTypeName { get { return "Global.Microsoft.Spatial.GeometryMultiPoint"; } } - internal override string DateTypeName { get { return "Global.Microsoft.OData.Edm.Date"; } } + internal override string DateOnlyTypeName { get { return "Global.System.DateOnly"; } } internal override string DateTimeOffsetTypeName { get { return "Global.System.DateTimeOffset"; } } internal override string DurationTypeName { get { return "Global.System.TimeSpan"; } } - internal override string TimeOfDayTypeName { get { return "Global.Microsoft.OData.Edm.TimeOfDay"; } } + internal override string TimeOnlyTypeName { get { return "Global.System.TimeOnly"; } } internal override string XmlConvertClassName { get { return "Global.System.Xml.XmlConvert"; } } internal override string EnumTypeName { get { return "Global.System.Enum"; } } internal override string DictionaryInterfaceName { get { return "Global.System.Collections.Generic.IDictionary(Of {0}, {1})"; } } diff --git a/src/ODataConnectedService/source.extension.vsixmanifest b/src/ODataConnectedService/source.extension.vsixmanifest index 7096a4fa..302bed95 100644 --- a/src/ODataConnectedService/source.extension.vsixmanifest +++ b/src/ODataConnectedService/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + OData Connected Service OData Connected Service for V1-V4 https://github.com/odata/ODataConnectedService diff --git a/src/ODataConnectedService_VS2022Plus/source.extension.vsixmanifest b/src/ODataConnectedService_VS2022Plus/source.extension.vsixmanifest index 4d5e0bf5..60c09afc 100644 --- a/src/ODataConnectedService_VS2022Plus/source.extension.vsixmanifest +++ b/src/ODataConnectedService_VS2022Plus/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + OData Connected Service 2022+ OData Connected Service for V1-V4 https://github.com/odata/ODataConnectedService diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.cs b/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.cs index a0404928..e2ad660e 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.cs +++ b/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.cs @@ -594,7 +594,7 @@ public virtual decimal DecimalPropWithLetter [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "DateProp is required.")] - public virtual global::Microsoft.OData.Edm.Date DateProp + public virtual global::System.DateOnly DateProp { get { @@ -608,15 +608,15 @@ public virtual decimal DecimalPropWithLetter } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - private global::Microsoft.OData.Edm.Date _DateProp = global::Microsoft.OData.Edm.Date.Parse("2020-02-02"); - partial void OnDatePropChanging(global::Microsoft.OData.Edm.Date value); + private global::System.DateOnly _DateProp = global::System.DateOnly.Parse("2020-02-02"); + partial void OnDatePropChanging(global::System.DateOnly value); partial void OnDatePropChanged(); /// /// There are no comments for Property NullableDateProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - public virtual global::System.Nullable NullableDateProp + public virtual global::System.Nullable NullableDateProp { get { @@ -630,8 +630,8 @@ public virtual decimal DecimalPropWithLetter } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - private global::System.Nullable _NullableDateProp = global::Microsoft.OData.Edm.Date.Parse("2020-02-02"); - partial void OnNullableDatePropChanging(global::System.Nullable value); + private global::System.Nullable _NullableDateProp = global::System.DateOnly.Parse("2020-02-02"); + partial void OnNullableDatePropChanging(global::System.Nullable value); partial void OnNullableDatePropChanged(); /// /// There are no comments for Property DateTimeOffsetProp in the schema. @@ -684,7 +684,7 @@ public virtual decimal DecimalPropWithLetter [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "TimeOfDayProp is required.")] - public virtual global::Microsoft.OData.Edm.TimeOfDay TimeOfDayProp + public virtual global::System.TimeOnly TimeOfDayProp { get { @@ -698,15 +698,15 @@ public virtual decimal DecimalPropWithLetter } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - private global::Microsoft.OData.Edm.TimeOfDay _TimeOfDayProp = global::Microsoft.OData.Edm.TimeOfDay.Parse("22:44"); - partial void OnTimeOfDayPropChanging(global::Microsoft.OData.Edm.TimeOfDay value); + private global::System.TimeOnly _TimeOfDayProp = global::System.TimeOnly.Parse("22:44"); + partial void OnTimeOfDayPropChanging(global::System.TimeOnly value); partial void OnTimeOfDayPropChanged(); /// /// There are no comments for Property NullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - public virtual global::System.Nullable NullableTimeOfDayProp + public virtual global::System.Nullable NullableTimeOfDayProp { get { @@ -720,8 +720,8 @@ public virtual decimal DecimalPropWithLetter } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")] - private global::System.Nullable _NullableTimeOfDayProp = global::Microsoft.OData.Edm.TimeOfDay.Parse("22:44"); - partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); + private global::System.Nullable _NullableTimeOfDayProp = global::System.TimeOnly.Parse("22:44"); + partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); partial void OnNullableTimeOfDayPropChanged(); /// /// There are no comments for Property DurationProp in the schema. diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.vb b/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.vb index 4960d7cf..8049c863 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.vb +++ b/test/ODataConnectedService.Tests/CodeGenReferences/EntityPropertiesWithDefaultValues.vb @@ -545,7 +545,7 @@ Namespace Namespace1 ''' _ _ - Public Overridable Property DateProp() As Global.Microsoft.OData.Edm.Date + Public Overridable Property DateProp() As Global.System.DateOnly Get Return Me._DateProp End Get @@ -556,8 +556,8 @@ Namespace Namespace1 End Set End Property _ - Private _DateProp As Global.Microsoft.OData.Edm.Date = Global.Microsoft.OData.Edm.Date.Parse("2020-02-02") - Partial Private Sub OnDatePropChanging(ByVal value As Global.Microsoft.OData.Edm.Date) + Private _DateProp As Global.System.DateOnly = Global.System.DateOnly.Parse("2020-02-02") + Partial Private Sub OnDatePropChanging(ByVal value As Global.System.DateOnly) End Sub Partial Private Sub OnDatePropChanged() End Sub @@ -565,7 +565,7 @@ Namespace Namespace1 ''' There are no comments for Property NullableDateProp in the schema. ''' _ - Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.System.DateOnly) Get Return Me._NullableDateProp End Get @@ -576,8 +576,8 @@ Namespace Namespace1 End Set End Property _ - Private _NullableDateProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) = Global.Microsoft.OData.Edm.Date.Parse("2020-02-02") - Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date)) + Private _NullableDateProp As Global.System.Nullable(Of Global.System.DateOnly) = Global.System.DateOnly.Parse("2020-02-02") + Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.System.DateOnly)) End Sub Partial Private Sub OnNullableDatePropChanged() End Sub @@ -627,7 +627,7 @@ Namespace Namespace1 ''' _ _ - Public Overridable Property TimeOfDayProp() As Global.Microsoft.OData.Edm.TimeOfDay + Public Overridable Property TimeOfDayProp() As Global.System.TimeOnly Get Return Me._TimeOfDayProp End Get @@ -638,8 +638,8 @@ Namespace Namespace1 End Set End Property _ - Private _TimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay = Global.Microsoft.OData.Edm.TimeOfDay.Parse("22:44") - Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.Microsoft.OData.Edm.TimeOfDay) + Private _TimeOfDayProp As Global.System.TimeOnly = Global.System.TimeOnly.Parse("22:44") + Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.System.TimeOnly) End Sub Partial Private Sub OnTimeOfDayPropChanged() End Sub @@ -647,7 +647,7 @@ Namespace Namespace1 ''' There are no comments for Property NullableTimeOfDayProp in the schema. ''' _ - Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.System.TimeOnly) Get Return Me._NullableTimeOfDayProp End Get @@ -658,8 +658,8 @@ Namespace Namespace1 End Set End Property _ - Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) = Global.Microsoft.OData.Edm.TimeOfDay.Parse("22:44") - Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.System.TimeOnly) = Global.System.TimeOnly.Parse("22:44") + Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnNullableTimeOfDayPropChanged() End Sub diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.cs b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.cs index 51a5ae05..c4149dcd 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.cs +++ b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.cs @@ -2765,8 +2765,8 @@ public static TestType CreateTestType(global::System.DateTimeOffset ID, string nonNullableStringProp, global::System.TimeSpan nonNullableDurationProp, global::System.DateTimeOffset nonNullableDateTimeOffsetProp, - global::Microsoft.OData.Edm.Date nonNullableDateProp, - global::Microsoft.OData.Edm.TimeOfDay nonNullableTimeOfDayProp, + global::System.DateOnly nonNullableDateProp, + global::System.TimeOnly nonNullableTimeOfDayProp, global::Microsoft.OData.Client.DataServiceStreamLink nonNullableStreamProp, sbyte nonNullableSByteProp, global::Microsoft.Spatial.Geography nonNullableGeography, @@ -3711,7 +3711,7 @@ public virtual string NullableStringProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "NonNullableDateProp is required.")] - public virtual global::Microsoft.OData.Edm.Date NonNullableDateProp + public virtual global::System.DateOnly NonNullableDateProp { get { @@ -3725,14 +3725,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.Date _NonNullableDateProp; - partial void OnNonNullableDatePropChanging(global::Microsoft.OData.Edm.Date value); + private global::System.DateOnly _NonNullableDateProp; + partial void OnNonNullableDatePropChanging(global::System.DateOnly value); partial void OnNonNullableDatePropChanged(); /// /// There are no comments for Property ExplicitlyNullableDateProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable ExplicitlyNullableDateProp + public virtual global::System.Nullable ExplicitlyNullableDateProp { get { @@ -3746,14 +3746,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _ExplicitlyNullableDateProp; - partial void OnExplicitlyNullableDatePropChanging(global::System.Nullable value); + private global::System.Nullable _ExplicitlyNullableDateProp; + partial void OnExplicitlyNullableDatePropChanging(global::System.Nullable value); partial void OnExplicitlyNullableDatePropChanged(); /// /// There are no comments for Property NullableDateProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable NullableDateProp + public virtual global::System.Nullable NullableDateProp { get { @@ -3767,15 +3767,15 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _NullableDateProp; - partial void OnNullableDatePropChanging(global::System.Nullable value); + private global::System.Nullable _NullableDateProp; + partial void OnNullableDatePropChanging(global::System.Nullable value); partial void OnNullableDatePropChanged(); /// /// There are no comments for Property NonNullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "NonNullableTimeOfDayProp is required.")] - public virtual global::Microsoft.OData.Edm.TimeOfDay NonNullableTimeOfDayProp + public virtual global::System.TimeOnly NonNullableTimeOfDayProp { get { @@ -3789,14 +3789,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.TimeOfDay _NonNullableTimeOfDayProp; - partial void OnNonNullableTimeOfDayPropChanging(global::Microsoft.OData.Edm.TimeOfDay value); + private global::System.TimeOnly _NonNullableTimeOfDayProp; + partial void OnNonNullableTimeOfDayPropChanging(global::System.TimeOnly value); partial void OnNonNullableTimeOfDayPropChanged(); /// /// There are no comments for Property ExplicitlyNullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable ExplicitlyNullableTimeOfDayProp + public virtual global::System.Nullable ExplicitlyNullableTimeOfDayProp { get { @@ -3810,14 +3810,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _ExplicitlyNullableTimeOfDayProp; - partial void OnExplicitlyNullableTimeOfDayPropChanging(global::System.Nullable value); + private global::System.Nullable _ExplicitlyNullableTimeOfDayProp; + partial void OnExplicitlyNullableTimeOfDayPropChanging(global::System.Nullable value); partial void OnExplicitlyNullableTimeOfDayPropChanged(); /// /// There are no comments for Property NullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable NullableTimeOfDayProp + public virtual global::System.Nullable NullableTimeOfDayProp { get { @@ -3831,8 +3831,8 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _NullableTimeOfDayProp; - partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); + private global::System.Nullable _NullableTimeOfDayProp; + partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); partial void OnNullableTimeOfDayPropChanged(); /// /// There are no comments for Property NonNullableStreamProp in the schema. @@ -5403,7 +5403,7 @@ public virtual int KeyProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "BagOfDate is required.")] - public virtual global::System.Collections.ObjectModel.Collection BagOfDate + public virtual global::System.Collections.ObjectModel.Collection BagOfDate { get { @@ -5417,15 +5417,15 @@ public virtual int KeyProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Collections.ObjectModel.Collection _BagOfDate = new global::System.Collections.ObjectModel.Collection(); - partial void OnBagOfDateChanging(global::System.Collections.ObjectModel.Collection value); + private global::System.Collections.ObjectModel.Collection _BagOfDate = new global::System.Collections.ObjectModel.Collection(); + partial void OnBagOfDateChanging(global::System.Collections.ObjectModel.Collection value); partial void OnBagOfDateChanged(); /// /// There are no comments for Property BagOfTimeOfDay in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "BagOfTimeOfDay is required.")] - public virtual global::System.Collections.ObjectModel.Collection BagOfTimeOfDay + public virtual global::System.Collections.ObjectModel.Collection BagOfTimeOfDay { get { @@ -5439,8 +5439,8 @@ public virtual int KeyProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Collections.ObjectModel.Collection _BagOfTimeOfDay = new global::System.Collections.ObjectModel.Collection(); - partial void OnBagOfTimeOfDayChanging(global::System.Collections.ObjectModel.Collection value); + private global::System.Collections.ObjectModel.Collection _BagOfTimeOfDay = new global::System.Collections.ObjectModel.Collection(); + partial void OnBagOfTimeOfDayChanging(global::System.Collections.ObjectModel.Collection value); partial void OnBagOfTimeOfDayChanged(); /// /// There are no comments for Property BagOfStream in the schema. @@ -6248,7 +6248,7 @@ public virtual sbyte SByteProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "DateProp is required.")] - public virtual global::Microsoft.OData.Edm.Date DateProp + public virtual global::System.DateOnly DateProp { get { @@ -6262,15 +6262,15 @@ public virtual sbyte SByteProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.Date _DateProp = global::Microsoft.OData.Edm.Date.Parse("2014-10-08"); - partial void OnDatePropChanging(global::Microsoft.OData.Edm.Date value); + private global::System.DateOnly _DateProp = global::System.DateOnly.Parse("2014-10-08"); + partial void OnDatePropChanging(global::System.DateOnly value); partial void OnDatePropChanged(); /// /// There are no comments for Property TimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "TimeOfDayProp is required.")] - public virtual global::Microsoft.OData.Edm.TimeOfDay TimeOfDayProp + public virtual global::System.TimeOnly TimeOfDayProp { get { @@ -6284,8 +6284,8 @@ public virtual sbyte SByteProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.TimeOfDay _TimeOfDayProp = global::Microsoft.OData.Edm.TimeOfDay.Parse("12:34:56"); - partial void OnTimeOfDayPropChanging(global::Microsoft.OData.Edm.TimeOfDay value); + private global::System.TimeOnly _TimeOfDayProp = global::System.TimeOnly.Parse("12:34:56"); + partial void OnTimeOfDayPropChanging(global::System.TimeOnly value); partial void OnTimeOfDayPropChanged(); /// /// There are no comments for Property GeographyProp in the schema. diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.vb b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.vb index 1a110a94..9cfdbe1e 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.vb +++ b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTest.vb @@ -2597,8 +2597,8 @@ Namespace MergedFunctionalTest ByVal nonNullableStringProp As String, _ ByVal nonNullableDurationProp As Global.System.TimeSpan, _ ByVal nonNullableDateTimeOffsetProp As Global.System.DateTimeOffset, _ - ByVal nonNullableDateProp As Global.Microsoft.OData.Edm.Date, _ - ByVal nonNullableTimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay, _ + ByVal nonNullableDateProp As Global.System.DateOnly, _ + ByVal nonNullableTimeOfDayProp As Global.System.TimeOnly, _ ByVal nonNullableStreamProp As Global.Microsoft.OData.Client.DataServiceStreamLink, _ ByVal nonNullableSByteProp As SByte, _ ByVal nonNullableGeography As Global.Microsoft.Spatial.Geography, _ @@ -3500,7 +3500,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property NonNullableDateProp() As Global.Microsoft.OData.Edm.Date + Public Overridable Property NonNullableDateProp() As Global.System.DateOnly Get Return Me._NonNullableDateProp End Get @@ -3511,8 +3511,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _NonNullableDateProp As Global.Microsoft.OData.Edm.Date - Partial Private Sub OnNonNullableDatePropChanging(ByVal value As Global.Microsoft.OData.Edm.Date) + Private _NonNullableDateProp As Global.System.DateOnly + Partial Private Sub OnNonNullableDatePropChanging(ByVal value As Global.System.DateOnly) End Sub Partial Private Sub OnNonNullableDatePropChanged() End Sub @@ -3520,7 +3520,7 @@ Namespace MergedFunctionalTest ''' There are no comments for Property ExplicitlyNullableDateProp in the schema. ''' _ - Public Overridable Property ExplicitlyNullableDateProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property ExplicitlyNullableDateProp() As Global.System.Nullable(Of Global.System.DateOnly) Get Return Me._ExplicitlyNullableDateProp End Get @@ -3531,8 +3531,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _ExplicitlyNullableDateProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) - Partial Private Sub OnExplicitlyNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date)) + Private _ExplicitlyNullableDateProp As Global.System.Nullable(Of Global.System.DateOnly) + Partial Private Sub OnExplicitlyNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.System.DateOnly)) End Sub Partial Private Sub OnExplicitlyNullableDatePropChanged() End Sub @@ -3540,7 +3540,7 @@ Namespace MergedFunctionalTest ''' There are no comments for Property NullableDateProp in the schema. ''' _ - Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.System.DateOnly) Get Return Me._NullableDateProp End Get @@ -3551,8 +3551,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _NullableDateProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) - Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date)) + Private _NullableDateProp As Global.System.Nullable(Of Global.System.DateOnly) + Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.System.DateOnly)) End Sub Partial Private Sub OnNullableDatePropChanged() End Sub @@ -3561,7 +3561,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property NonNullableTimeOfDayProp() As Global.Microsoft.OData.Edm.TimeOfDay + Public Overridable Property NonNullableTimeOfDayProp() As Global.System.TimeOnly Get Return Me._NonNullableTimeOfDayProp End Get @@ -3572,8 +3572,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _NonNullableTimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay - Partial Private Sub OnNonNullableTimeOfDayPropChanging(ByVal value As Global.Microsoft.OData.Edm.TimeOfDay) + Private _NonNullableTimeOfDayProp As Global.System.TimeOnly + Partial Private Sub OnNonNullableTimeOfDayPropChanging(ByVal value As Global.System.TimeOnly) End Sub Partial Private Sub OnNonNullableTimeOfDayPropChanged() End Sub @@ -3581,7 +3581,7 @@ Namespace MergedFunctionalTest ''' There are no comments for Property ExplicitlyNullableTimeOfDayProp in the schema. ''' _ - Public Overridable Property ExplicitlyNullableTimeOfDayProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property ExplicitlyNullableTimeOfDayProp() As Global.System.Nullable(Of Global.System.TimeOnly) Get Return Me._ExplicitlyNullableTimeOfDayProp End Get @@ -3592,8 +3592,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _ExplicitlyNullableTimeOfDayProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) - Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _ExplicitlyNullableTimeOfDayProp As Global.System.Nullable(Of Global.System.TimeOnly) + Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanged() End Sub @@ -3601,7 +3601,7 @@ Namespace MergedFunctionalTest ''' There are no comments for Property NullableTimeOfDayProp in the schema. ''' _ - Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.System.TimeOnly) Get Return Me._NullableTimeOfDayProp End Get @@ -3612,8 +3612,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) - Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.System.TimeOnly) + Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnNullableTimeOfDayPropChanged() End Sub @@ -5116,7 +5116,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property BagOfDate() As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property BagOfDate() As Global.System.Collections.ObjectModel.Collection(Of Global.System.DateOnly) Get Return Me._BagOfDate End Get @@ -5127,8 +5127,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _BagOfDate As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.Date) = New Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.Date)() - Partial Private Sub OnBagOfDateChanging(ByVal value As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.Date)) + Private _BagOfDate As Global.System.Collections.ObjectModel.Collection(Of Global.System.DateOnly) = New Global.System.Collections.ObjectModel.Collection(Of Global.System.DateOnly)() + Partial Private Sub OnBagOfDateChanging(ByVal value As Global.System.Collections.ObjectModel.Collection(Of Global.System.DateOnly)) End Sub Partial Private Sub OnBagOfDateChanged() End Sub @@ -5137,7 +5137,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property BagOfTimeOfDay() As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property BagOfTimeOfDay() As Global.System.Collections.ObjectModel.Collection(Of Global.System.TimeOnly) Get Return Me._BagOfTimeOfDay End Get @@ -5148,8 +5148,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _BagOfTimeOfDay As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.TimeOfDay) = New Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.TimeOfDay)() - Partial Private Sub OnBagOfTimeOfDayChanging(ByVal value As Global.System.Collections.ObjectModel.Collection(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _BagOfTimeOfDay As Global.System.Collections.ObjectModel.Collection(Of Global.System.TimeOnly) = New Global.System.Collections.ObjectModel.Collection(Of Global.System.TimeOnly)() + Partial Private Sub OnBagOfTimeOfDayChanging(ByVal value As Global.System.Collections.ObjectModel.Collection(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnBagOfTimeOfDayChanged() End Sub @@ -5926,7 +5926,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property DateProp() As Global.Microsoft.OData.Edm.Date + Public Overridable Property DateProp() As Global.System.DateOnly Get Return Me._DateProp End Get @@ -5937,8 +5937,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _DateProp As Global.Microsoft.OData.Edm.Date = Global.Microsoft.OData.Edm.Date.Parse("2014-10-08") - Partial Private Sub OnDatePropChanging(ByVal value As Global.Microsoft.OData.Edm.Date) + Private _DateProp As Global.System.DateOnly = Global.System.DateOnly.Parse("2014-10-08") + Partial Private Sub OnDatePropChanging(ByVal value As Global.System.DateOnly) End Sub Partial Private Sub OnDatePropChanged() End Sub @@ -5947,7 +5947,7 @@ Namespace MergedFunctionalTest ''' _ _ - Public Overridable Property TimeOfDayProp() As Global.Microsoft.OData.Edm.TimeOfDay + Public Overridable Property TimeOfDayProp() As Global.System.TimeOnly Get Return Me._TimeOfDayProp End Get @@ -5958,8 +5958,8 @@ Namespace MergedFunctionalTest End Set End Property _ - Private _TimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay = Global.Microsoft.OData.Edm.TimeOfDay.Parse("12:34:56") - Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.Microsoft.OData.Edm.TimeOfDay) + Private _TimeOfDayProp As Global.System.TimeOnly = Global.System.TimeOnly.Parse("12:34:56") + Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.System.TimeOnly) End Sub Partial Private Sub OnTimeOfDayPropChanged() End Sub diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.cs b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.cs index e5179269..a99fe767 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.cs +++ b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.cs @@ -2959,8 +2959,8 @@ public static TestType CreateTestType(global::System.DateTimeOffset ID, string nonNullableStringProp, global::System.TimeSpan nonNullableDurationProp, global::System.DateTimeOffset nonNullableDateTimeOffsetProp, - global::Microsoft.OData.Edm.Date nonNullableDateProp, - global::Microsoft.OData.Edm.TimeOfDay nonNullableTimeOfDayProp, + global::System.DateOnly nonNullableDateProp, + global::System.TimeOnly nonNullableTimeOfDayProp, global::Microsoft.OData.Client.DataServiceStreamLink nonNullableStreamProp, sbyte nonNullableSByteProp, global::Microsoft.Spatial.Geography nonNullableGeography, @@ -3946,7 +3946,7 @@ public virtual string NullableStringProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "NonNullableDateProp is required.")] - public virtual global::Microsoft.OData.Edm.Date NonNullableDateProp + public virtual global::System.DateOnly NonNullableDateProp { get { @@ -3961,14 +3961,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.Date _NonNullableDateProp; - partial void OnNonNullableDatePropChanging(global::Microsoft.OData.Edm.Date value); + private global::System.DateOnly _NonNullableDateProp; + partial void OnNonNullableDatePropChanging(global::System.DateOnly value); partial void OnNonNullableDatePropChanged(); /// /// There are no comments for Property ExplicitlyNullableDateProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable ExplicitlyNullableDateProp + public virtual global::System.Nullable ExplicitlyNullableDateProp { get { @@ -3983,14 +3983,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _ExplicitlyNullableDateProp; - partial void OnExplicitlyNullableDatePropChanging(global::System.Nullable value); + private global::System.Nullable _ExplicitlyNullableDateProp; + partial void OnExplicitlyNullableDatePropChanging(global::System.Nullable value); partial void OnExplicitlyNullableDatePropChanged(); /// /// There are no comments for Property NullableDateProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable NullableDateProp + public virtual global::System.Nullable NullableDateProp { get { @@ -4005,15 +4005,15 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _NullableDateProp; - partial void OnNullableDatePropChanging(global::System.Nullable value); + private global::System.Nullable _NullableDateProp; + partial void OnNullableDatePropChanging(global::System.Nullable value); partial void OnNullableDatePropChanged(); /// /// There are no comments for Property NonNullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "NonNullableTimeOfDayProp is required.")] - public virtual global::Microsoft.OData.Edm.TimeOfDay NonNullableTimeOfDayProp + public virtual global::System.TimeOnly NonNullableTimeOfDayProp { get { @@ -4028,14 +4028,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.TimeOfDay _NonNullableTimeOfDayProp; - partial void OnNonNullableTimeOfDayPropChanging(global::Microsoft.OData.Edm.TimeOfDay value); + private global::System.TimeOnly _NonNullableTimeOfDayProp; + partial void OnNonNullableTimeOfDayPropChanging(global::System.TimeOnly value); partial void OnNonNullableTimeOfDayPropChanged(); /// /// There are no comments for Property ExplicitlyNullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable ExplicitlyNullableTimeOfDayProp + public virtual global::System.Nullable ExplicitlyNullableTimeOfDayProp { get { @@ -4050,14 +4050,14 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _ExplicitlyNullableTimeOfDayProp; - partial void OnExplicitlyNullableTimeOfDayPropChanging(global::System.Nullable value); + private global::System.Nullable _ExplicitlyNullableTimeOfDayProp; + partial void OnExplicitlyNullableTimeOfDayPropChanging(global::System.Nullable value); partial void OnExplicitlyNullableTimeOfDayPropChanged(); /// /// There are no comments for Property NullableTimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable NullableTimeOfDayProp + public virtual global::System.Nullable NullableTimeOfDayProp { get { @@ -4072,8 +4072,8 @@ public virtual string NullableStringProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _NullableTimeOfDayProp; - partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); + private global::System.Nullable _NullableTimeOfDayProp; + partial void OnNullableTimeOfDayPropChanging(global::System.Nullable value); partial void OnNullableTimeOfDayPropChanged(); /// /// There are no comments for Property NonNullableStreamProp in the schema. @@ -5733,7 +5733,7 @@ public virtual int KeyProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "BagOfDate is required.")] - public virtual global::System.Collections.ObjectModel.ObservableCollection BagOfDate + public virtual global::System.Collections.ObjectModel.ObservableCollection BagOfDate { get { @@ -5748,15 +5748,15 @@ public virtual int KeyProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Collections.ObjectModel.ObservableCollection _BagOfDate = new global::System.Collections.ObjectModel.ObservableCollection(); - partial void OnBagOfDateChanging(global::System.Collections.ObjectModel.ObservableCollection value); + private global::System.Collections.ObjectModel.ObservableCollection _BagOfDate = new global::System.Collections.ObjectModel.ObservableCollection(); + partial void OnBagOfDateChanging(global::System.Collections.ObjectModel.ObservableCollection value); partial void OnBagOfDateChanged(); /// /// There are no comments for Property BagOfTimeOfDay in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "BagOfTimeOfDay is required.")] - public virtual global::System.Collections.ObjectModel.ObservableCollection BagOfTimeOfDay + public virtual global::System.Collections.ObjectModel.ObservableCollection BagOfTimeOfDay { get { @@ -5771,8 +5771,8 @@ public virtual int KeyProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Collections.ObjectModel.ObservableCollection _BagOfTimeOfDay = new global::System.Collections.ObjectModel.ObservableCollection(); - partial void OnBagOfTimeOfDayChanging(global::System.Collections.ObjectModel.ObservableCollection value); + private global::System.Collections.ObjectModel.ObservableCollection _BagOfTimeOfDay = new global::System.Collections.ObjectModel.ObservableCollection(); + partial void OnBagOfTimeOfDayChanging(global::System.Collections.ObjectModel.ObservableCollection value); partial void OnBagOfTimeOfDayChanged(); /// /// There are no comments for Property BagOfStream in the schema. @@ -6632,7 +6632,7 @@ public virtual sbyte SByteProp /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "DateProp is required.")] - public virtual global::Microsoft.OData.Edm.Date DateProp + public virtual global::System.DateOnly DateProp { get { @@ -6647,15 +6647,15 @@ public virtual sbyte SByteProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.Date _DateProp = global::Microsoft.OData.Edm.Date.Parse("2014-10-08"); - partial void OnDatePropChanging(global::Microsoft.OData.Edm.Date value); + private global::System.DateOnly _DateProp = global::System.DateOnly.Parse("2014-10-08"); + partial void OnDatePropChanging(global::System.DateOnly value); partial void OnDatePropChanged(); /// /// There are no comments for Property TimeOfDayProp in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] [global::System.ComponentModel.DataAnnotations.RequiredAttribute(ErrorMessage = "TimeOfDayProp is required.")] - public virtual global::Microsoft.OData.Edm.TimeOfDay TimeOfDayProp + public virtual global::System.TimeOnly TimeOfDayProp { get { @@ -6670,8 +6670,8 @@ public virtual sbyte SByteProp } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::Microsoft.OData.Edm.TimeOfDay _TimeOfDayProp = global::Microsoft.OData.Edm.TimeOfDay.Parse("12:34:56"); - partial void OnTimeOfDayPropChanging(global::Microsoft.OData.Edm.TimeOfDay value); + private global::System.TimeOnly _TimeOfDayProp = global::System.TimeOnly.Parse("12:34:56"); + partial void OnTimeOfDayPropChanging(global::System.TimeOnly value); partial void OnTimeOfDayPropChanged(); /// /// There are no comments for Property GeographyProp in the schema. diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.vb b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.vb index c5d089e3..98f59009 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.vb +++ b/test/ODataConnectedService.Tests/CodeGenReferences/MergedFunctionalTestDSC.vb @@ -2783,8 +2783,8 @@ Namespace MergedFunctionalTest.DSC ByVal nonNullableStringProp As String, _ ByVal nonNullableDurationProp As Global.System.TimeSpan, _ ByVal nonNullableDateTimeOffsetProp As Global.System.DateTimeOffset, _ - ByVal nonNullableDateProp As Global.Microsoft.OData.Edm.Date, _ - ByVal nonNullableTimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay, _ + ByVal nonNullableDateProp As Global.System.DateOnly, _ + ByVal nonNullableTimeOfDayProp As Global.System.TimeOnly, _ ByVal nonNullableStreamProp As Global.Microsoft.OData.Client.DataServiceStreamLink, _ ByVal nonNullableSByteProp As SByte, _ ByVal nonNullableGeography As Global.Microsoft.Spatial.Geography, _ @@ -3727,7 +3727,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property NonNullableDateProp() As Global.Microsoft.OData.Edm.Date + Public Overridable Property NonNullableDateProp() As Global.System.DateOnly Get Return Me._NonNullableDateProp End Get @@ -3739,8 +3739,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _NonNullableDateProp As Global.Microsoft.OData.Edm.Date - Partial Private Sub OnNonNullableDatePropChanging(ByVal value As Global.Microsoft.OData.Edm.Date) + Private _NonNullableDateProp As Global.System.DateOnly + Partial Private Sub OnNonNullableDatePropChanging(ByVal value As Global.System.DateOnly) End Sub Partial Private Sub OnNonNullableDatePropChanged() End Sub @@ -3748,7 +3748,7 @@ Namespace MergedFunctionalTest.DSC ''' There are no comments for Property ExplicitlyNullableDateProp in the schema. ''' _ - Public Overridable Property ExplicitlyNullableDateProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property ExplicitlyNullableDateProp() As Global.System.Nullable(Of Global.System.DateOnly) Get Return Me._ExplicitlyNullableDateProp End Get @@ -3760,8 +3760,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _ExplicitlyNullableDateProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) - Partial Private Sub OnExplicitlyNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date)) + Private _ExplicitlyNullableDateProp As Global.System.Nullable(Of Global.System.DateOnly) + Partial Private Sub OnExplicitlyNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.System.DateOnly)) End Sub Partial Private Sub OnExplicitlyNullableDatePropChanged() End Sub @@ -3769,7 +3769,7 @@ Namespace MergedFunctionalTest.DSC ''' There are no comments for Property NullableDateProp in the schema. ''' _ - Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property NullableDateProp() As Global.System.Nullable(Of Global.System.DateOnly) Get Return Me._NullableDateProp End Get @@ -3781,8 +3781,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _NullableDateProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date) - Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.Date)) + Private _NullableDateProp As Global.System.Nullable(Of Global.System.DateOnly) + Partial Private Sub OnNullableDatePropChanging(ByVal value As Global.System.Nullable(Of Global.System.DateOnly)) End Sub Partial Private Sub OnNullableDatePropChanged() End Sub @@ -3791,7 +3791,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property NonNullableTimeOfDayProp() As Global.Microsoft.OData.Edm.TimeOfDay + Public Overridable Property NonNullableTimeOfDayProp() As Global.System.TimeOnly Get Return Me._NonNullableTimeOfDayProp End Get @@ -3803,8 +3803,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _NonNullableTimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay - Partial Private Sub OnNonNullableTimeOfDayPropChanging(ByVal value As Global.Microsoft.OData.Edm.TimeOfDay) + Private _NonNullableTimeOfDayProp As Global.System.TimeOnly + Partial Private Sub OnNonNullableTimeOfDayPropChanging(ByVal value As Global.System.TimeOnly) End Sub Partial Private Sub OnNonNullableTimeOfDayPropChanged() End Sub @@ -3812,7 +3812,7 @@ Namespace MergedFunctionalTest.DSC ''' There are no comments for Property ExplicitlyNullableTimeOfDayProp in the schema. ''' _ - Public Overridable Property ExplicitlyNullableTimeOfDayProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property ExplicitlyNullableTimeOfDayProp() As Global.System.Nullable(Of Global.System.TimeOnly) Get Return Me._ExplicitlyNullableTimeOfDayProp End Get @@ -3824,8 +3824,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _ExplicitlyNullableTimeOfDayProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) - Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _ExplicitlyNullableTimeOfDayProp As Global.System.Nullable(Of Global.System.TimeOnly) + Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnExplicitlyNullableTimeOfDayPropChanged() End Sub @@ -3833,7 +3833,7 @@ Namespace MergedFunctionalTest.DSC ''' There are no comments for Property NullableTimeOfDayProp in the schema. ''' _ - Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property NullableTimeOfDayProp() As Global.System.Nullable(Of Global.System.TimeOnly) Get Return Me._NullableTimeOfDayProp End Get @@ -3845,8 +3845,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay) - Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _NullableTimeOfDayProp As Global.System.Nullable(Of Global.System.TimeOnly) + Partial Private Sub OnNullableTimeOfDayPropChanging(ByVal value As Global.System.Nullable(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnNullableTimeOfDayPropChanged() End Sub @@ -5437,7 +5437,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property BagOfDate() As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.Date) + Public Overridable Property BagOfDate() As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.DateOnly) Get Return Me._BagOfDate End Get @@ -5449,8 +5449,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _BagOfDate As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.Date) = New Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.Date)() - Partial Private Sub OnBagOfDateChanging(ByVal value As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.Date)) + Private _BagOfDate As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.DateOnly) = New Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.DateOnly)() + Partial Private Sub OnBagOfDateChanging(ByVal value As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.DateOnly)) End Sub Partial Private Sub OnBagOfDateChanged() End Sub @@ -5459,7 +5459,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property BagOfTimeOfDay() As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.TimeOfDay) + Public Overridable Property BagOfTimeOfDay() As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.TimeOnly) Get Return Me._BagOfTimeOfDay End Get @@ -5471,8 +5471,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _BagOfTimeOfDay As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.TimeOfDay) = New Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.TimeOfDay)() - Partial Private Sub OnBagOfTimeOfDayChanging(ByVal value As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.Microsoft.OData.Edm.TimeOfDay)) + Private _BagOfTimeOfDay As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.TimeOnly) = New Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.TimeOnly)() + Partial Private Sub OnBagOfTimeOfDayChanging(ByVal value As Global.System.Collections.ObjectModel.ObservableCollection(Of Global.System.TimeOnly)) End Sub Partial Private Sub OnBagOfTimeOfDayChanged() End Sub @@ -6300,7 +6300,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property DateProp() As Global.Microsoft.OData.Edm.Date + Public Overridable Property DateProp() As Global.System.DateOnly Get Return Me._DateProp End Get @@ -6312,8 +6312,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _DateProp As Global.Microsoft.OData.Edm.Date = Global.Microsoft.OData.Edm.Date.Parse("2014-10-08") - Partial Private Sub OnDatePropChanging(ByVal value As Global.Microsoft.OData.Edm.Date) + Private _DateProp As Global.System.DateOnly = Global.System.DateOnly.Parse("2014-10-08") + Partial Private Sub OnDatePropChanging(ByVal value As Global.System.DateOnly) End Sub Partial Private Sub OnDatePropChanged() End Sub @@ -6322,7 +6322,7 @@ Namespace MergedFunctionalTest.DSC ''' _ _ - Public Overridable Property TimeOfDayProp() As Global.Microsoft.OData.Edm.TimeOfDay + Public Overridable Property TimeOfDayProp() As Global.System.TimeOnly Get Return Me._TimeOfDayProp End Get @@ -6334,8 +6334,8 @@ Namespace MergedFunctionalTest.DSC End Set End Property _ - Private _TimeOfDayProp As Global.Microsoft.OData.Edm.TimeOfDay = Global.Microsoft.OData.Edm.TimeOfDay.Parse("12:34:56") - Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.Microsoft.OData.Edm.TimeOfDay) + Private _TimeOfDayProp As Global.System.TimeOnly = Global.System.TimeOnly.Parse("12:34:56") + Partial Private Sub OnTimeOfDayPropChanging(ByVal value As Global.System.TimeOnly) End Sub Partial Private Sub OnTimeOfDayPropChanged() End Sub diff --git a/test/ODataConnectedService.Tests/CodeGenReferences/TypeDefinitionsParamsConvertedToUnderlyingType.cs b/test/ODataConnectedService.Tests/CodeGenReferences/TypeDefinitionsParamsConvertedToUnderlyingType.cs index c1034872..6969888d 100644 --- a/test/ODataConnectedService.Tests/CodeGenReferences/TypeDefinitionsParamsConvertedToUnderlyingType.cs +++ b/test/ODataConnectedService.Tests/CodeGenReferences/TypeDefinitionsParamsConvertedToUnderlyingType.cs @@ -81,7 +81,7 @@ public virtual string UserName /// There are no comments for Property WakeUpTime in the schema. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - public virtual global::System.Nullable WakeUpTime + public virtual global::System.Nullable WakeUpTime { get { @@ -95,8 +95,8 @@ public virtual string UserName } } [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "2.4.0")] - private global::System.Nullable _WakeUpTime; - partial void OnWakeUpTimeChanging(global::System.Nullable value); + private global::System.Nullable _WakeUpTime; + partial void OnWakeUpTimeChanging(global::System.Nullable value); partial void OnWakeUpTimeChanged(); /// /// There are no comments for ReminderView in the schema. diff --git a/test/ODataConnectedService.Tests/Templates/ODataClientTemplateUnitTests.cs b/test/ODataConnectedService.Tests/Templates/ODataClientTemplateUnitTests.cs index fdff2c98..88e816f2 100644 --- a/test/ODataConnectedService.Tests/Templates/ODataClientTemplateUnitTests.cs +++ b/test/ODataConnectedService.Tests/Templates/ODataClientTemplateUnitTests.cs @@ -288,14 +288,14 @@ internal override string GeometryMultiPointTypeName get { return "GeometryMultiPoint"; } } - internal override string DateTypeName + internal override string DateOnlyTypeName { - get { return "Date"; } + get { return "DateOnly"; } } - internal override string TimeOfDayTypeName + internal override string TimeOnlyTypeName { - get { return "TimeOfDay"; } + get { return "TimeOnly"; } } internal override string DateTimeOffsetTypeName diff --git a/test/ODataConnectedService.Tests/Templates/ODataT4CodeGeneratorTests.cs b/test/ODataConnectedService.Tests/Templates/ODataT4CodeGeneratorTests.cs index fa7a745a..331a2d13 100644 --- a/test/ODataConnectedService.Tests/Templates/ODataT4CodeGeneratorTests.cs +++ b/test/ODataConnectedService.Tests/Templates/ODataT4CodeGeneratorTests.cs @@ -715,8 +715,19 @@ private static string CodeGenWithT4Template(string edmx, string namespacePrefix, if (CompileGeneratedCode && !generateMultipleFiles) { - // Comment next line to not to verify that the generated code can be compiled successfully - GeneratedCodeHelpers.VerifyGeneratedCodeCompiles(code, isCSharp); + // .NET Framework 4.7.2 compatibility: This test project targets .NET Framework 4.7.2 because Visual Studio + // extensions do not support .NET 10 yet. Replace .NET 6+ types (System.DateOnly, System.TimeOnly) with their + // OData EDM equivalents (Date, TimeOfDay) available in ODL that supports .NET Framework 4.7.2. + if (code.Contains("System.TimeOnly") || code.Contains("System.DateOnly")) + { + // Comment next line to not to verify that the generated code can be compiled successfully + GeneratedCodeHelpers.VerifyGeneratedCodeCompiles(code.Replace("System.TimeOnly", "Microsoft.OData.Edm.TimeOfDay").Replace("System.DateOnly", "Microsoft.OData.Edm.Date"), isCSharp); + } + else + { + // Comment next line to not to verify that the generated code can be compiled successfully + GeneratedCodeHelpers.VerifyGeneratedCodeCompiles(code, isCSharp); + } } return code; diff --git a/test/ODataConnectedService.Tests/Templates/UtilsTests.cs b/test/ODataConnectedService.Tests/Templates/UtilsTests.cs index d610e58d..bc6194ee 100644 --- a/test/ODataConnectedService.Tests/Templates/UtilsTests.cs +++ b/test/ODataConnectedService.Tests/Templates/UtilsTests.cs @@ -600,13 +600,13 @@ public void GetClrTypeNameDurationShouldBeGlobalSystemTimeSpan() [TestMethod] public void GetClrTypeNameDateShouldBeGlobalMicrosoftODataEdmLibraryDate() { - ODataT4CodeGenerator.Utils.GetClrTypeName(new EdmPrimitiveType(EdmPrimitiveTypeKind.Date), template).Should().Be("global::Microsoft.OData.Edm.Date"); + ODataT4CodeGenerator.Utils.GetClrTypeName(new EdmPrimitiveType(EdmPrimitiveTypeKind.Date), template).Should().Be("global::System.DateOnly"); } [TestMethod] public void GetClrTypeNameTimeOfDayShouldBeGlobalMicrosoftODataEdmLibraryTimeOfDay() { - ODataT4CodeGenerator.Utils.GetClrTypeName(new EdmPrimitiveType(EdmPrimitiveTypeKind.TimeOfDay), template).Should().Be("global::Microsoft.OData.Edm.TimeOfDay"); + ODataT4CodeGenerator.Utils.GetClrTypeName(new EdmPrimitiveType(EdmPrimitiveTypeKind.TimeOfDay), template).Should().Be("global::System.TimeOnly"); } [TestMethod] diff --git a/test/ODataConnectedService.Tests/TestHelpers/GeneratedCodeHelpers.cs b/test/ODataConnectedService.Tests/TestHelpers/GeneratedCodeHelpers.cs index 40a1d597..6c3eee3f 100644 --- a/test/ODataConnectedService.Tests/TestHelpers/GeneratedCodeHelpers.cs +++ b/test/ODataConnectedService.Tests/TestHelpers/GeneratedCodeHelpers.cs @@ -151,6 +151,15 @@ private static CompilerResults CompileCode(string source, bool isCSharp) } } + // .NET Framework 4.7.2 compatibility for testing: System.TimeOnly and System.DateOnly were introduced in .NET 6. + // This test project targets .NET Framework 4.7.2 (cannot upgrade to .NET 10 because Visual Studio + // extensions do not support .NET 10 yet), so we replace these types with their OData EDM equivalents + // (TimeOfDay and Date) available in ODL (OData Edm library) which supports .NET Framework 4.7.2. + if (source.Contains("System.TimeOnly") || source.Contains("System.DateOnly")) + { + source = source.Replace("System.TimeOnly", "Microsoft.OData.Edm.TimeOfDay").Replace("System.DateOnly", "Microsoft.OData.Edm.Date"); + } + CompilerResults results = codeProvider.CompileAssemblyFromSource(compilerOptions, source); return results; }