From 89362bb60fc7e9fcbcf04cb3144a3d992d0e6745 Mon Sep 17 00:00:00 2001 From: Dr Freon Date: Fri, 10 Jun 2016 16:18:43 -0400 Subject: [PATCH] Addresses issue #1087 (#1110) Adds CustomInitialize() to Azure service client --- .../AzureBodyDuration/AutoRestDurationTestService.cs | 5 +++++ .../AzureCompositeModelClient/AzureCompositeModel.cs | 5 +++++ .../AutoRestParameterGroupingTestService.cs | 5 +++++ .../AzureReport/AutoRestReportServiceForAzure.cs | 5 +++++ .../AzureResource/AutoRestResourceFlatteningTestService.cs | 5 +++++ .../AutoRestAzureSpecialParametersTestClient.cs | 5 +++++ .../CustomBaseUri/AutoRestParameterizedHostTestClient.cs | 5 +++++ .../AcceptanceTests/Head/AutoRestHeadTestService.cs | 5 +++++ .../HeadExceptions/AutoRestHeadExceptionTestService.cs | 5 +++++ .../Lro/AutoRestLongRunningOperationTestService.cs | 5 +++++ .../AcceptanceTests/Paging/AutoRestPagingTestService.cs | 5 +++++ .../SubscriptionIdApiVersion/MicrosoftAzureTestUrl.cs | 5 +++++ .../Templates/AzureServiceClientTemplate.cshtml | 7 +++++++ 13 files changed, 67 insertions(+) diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs index 1e390935cb..5568bf10d9 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs @@ -264,6 +264,10 @@ public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credent } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -299,6 +303,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs index 839f9cb24d..264a98d8b5 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs @@ -305,6 +305,10 @@ public AzureCompositeModel(Uri baseUri, ServiceClientCredentials credentials, Ht } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -350,6 +354,7 @@ private void Initialize() }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("fishtype")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("fishtype")); + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } /// diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs index fac44181bf..ca2268fbab 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs @@ -264,6 +264,10 @@ public AutoRestParameterGroupingTestService(Uri baseUri, ServiceClientCredential } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -299,6 +303,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs index 9025219bc0..03c2bc4366 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs @@ -259,6 +259,10 @@ public AutoRestReportServiceForAzure(Uri baseUri, ServiceClientCredentials crede } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -293,6 +297,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } /// diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs index 5e3a7c82bf..82fea546ef 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs @@ -259,6 +259,10 @@ public AutoRestResourceFlatteningTestService(Uri baseUri, ServiceClientCredentia } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -294,6 +298,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs index d004c6aa32..049f0911e1 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs @@ -311,6 +311,10 @@ public AutoRestAzureSpecialParametersTestClient(Uri baseUri, ServiceClientCreden } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -354,6 +358,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs index 2dcce4d423..fc03481d9d 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs @@ -155,6 +155,10 @@ public AutoRestParameterizedHostTestClient(ServiceClientCredentials credentials, } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -191,6 +195,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs index 1cb027227a..05b0dd03b4 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs @@ -263,6 +263,10 @@ public AutoRestHeadTestService(Uri baseUri, ServiceClientCredentials credentials } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -298,6 +302,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs index 8d6d1511f5..d4d73ccad9 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs @@ -263,6 +263,10 @@ public AutoRestHeadExceptionTestService(Uri baseUri, ServiceClientCredentials cr } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -298,6 +302,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs index 52624e5848..e2cfb05d00 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs @@ -279,6 +279,10 @@ public AutoRestLongRunningOperationTestService(Uri baseUri, ServiceClientCredent } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -318,6 +322,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/AutoRestPagingTestService.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/AutoRestPagingTestService.cs index 96e491913b..5f18e4bc51 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/AutoRestPagingTestService.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/Paging/AutoRestPagingTestService.cs @@ -264,6 +264,10 @@ public AutoRestPagingTestService(Uri baseUri, ServiceClientCredentials credentia } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -299,6 +303,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/MicrosoftAzureTestUrl.cs b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/MicrosoftAzureTestUrl.cs index deead47817..7dcd841caa 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/MicrosoftAzureTestUrl.cs +++ b/AutoRest/Generators/CSharp/Azure.CSharp.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/MicrosoftAzureTestUrl.cs @@ -274,6 +274,10 @@ public MicrosoftAzureTestUrl(Uri baseUri, ServiceClientCredentials credentials, } } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); /// /// Initializes client properties. /// @@ -310,6 +314,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureServiceClientTemplate.cshtml b/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureServiceClientTemplate.cshtml index 107453541e..b9aa0bfd38 100644 --- a/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureServiceClientTemplate.cshtml +++ b/AutoRest/Generators/CSharp/Azure.CSharp/Templates/AzureServiceClientTemplate.cshtml @@ -38,6 +38,11 @@ namespace @Settings.Namespace { @(Include(new ServiceClientBodyTemplate(), (ServiceClientTemplateModel)Model)) + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// /// Initializes client properties. /// @@ -97,6 +102,8 @@ namespace @Settings.Namespace @:DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<@(polymorphicType.Name)>("@(polymorphicType.PolymorphicDiscriminator)")); } + CustomInitialize(); + @if (Model.NeedsTransformationConverter) { @:DeserializationSettings.Converters.Add(new TransformationJsonConverter());