diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 680375a7499..acc99626c58 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -29,6 +29,12 @@ namespace {{packageName}}.Client BasePath = basePath; RestClient = new RestClient(BasePath); } + + /// + /// Gets or sets the default API client for making HTTP calls. + /// + /// The default API client. + public static ApiClient Default = new ApiClient(); /// /// Gets or sets the base path. diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index be02678bcbf..a28b395b0db 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -12,6 +12,17 @@ namespace {{packageName}}.Client /// public class Configuration { + /// + /// Initializes a new instance of the Configuration class. + /// + /// Api client. + public Configuration(ApiClient apiClient=null) + { + if (apiClient == null) + ApiClient = ApiClient.Default; + else + ApiClient = apiClient; + } /// /// Version of the package. @@ -20,16 +31,16 @@ namespace {{packageName}}.Client public const string Version = "{{packageVersion}}"; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the default Configuration. /// - /// The API client. - public static Configuration DefaultConfiguration = new Configuration(); + /// Configuration. + public static Configuration Default = new Configuration(); /// /// Gets or sets the default API client for making HTTP calls. /// /// The API client. - public ApiClient ApiClient = new ApiClient(); + public ApiClient ApiClient; /// /// Gets or sets the username (HTTP basic authentication). diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache index bb72037bad9..3689729ce41 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache @@ -49,7 +49,7 @@ namespace {{packageName}}.Api /// public {{classname}}(String basePath) { - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; this.SetBasePath(basePath); } @@ -62,7 +62,7 @@ namespace {{packageName}}.Api public {{classname}}(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; else this.Configuration = configuration; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs index 2b4f77bf4de..989ee05d0d9 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs @@ -198,20 +198,20 @@ namespace IO.Swagger.Api /// public PetApi(String basePath) { - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; this.SetBasePath(basePath); } /// /// Initializes a new instance of the class - /// using Configuration object. + /// using Configuration object /// /// An instance of Configuration /// public PetApi(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; else this.Configuration = configuration; } @@ -236,20 +236,21 @@ namespace IO.Swagger.Api } /// - /// Gets or sets the configuration object. + /// Gets or sets the configuration object /// /// An instance of the Configuration public Configuration Configuration {get; set;} /// - /// Gets the status code of the previous request. + /// Gets the status code of the previous request /// public int StatusCode { get; private set; } /// - /// Gets the response headers of the previous request. + /// Gets the response headers of the previous request /// - public Dictionary ResponseHeaders { get; private set; } + public Dictionary ResponseHeaders { get; private set; } + /// /// Update an existing pet diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs index dafb93d9458..2eae0cebc46 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs @@ -106,7 +106,7 @@ namespace IO.Swagger.Api /// public StoreApi(String basePath) { - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; this.SetBasePath(basePath); } @@ -119,7 +119,7 @@ namespace IO.Swagger.Api public StoreApi(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; else this.Configuration = configuration; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs index c2c23cddfc2..e3e67eaa9fb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs @@ -190,7 +190,7 @@ namespace IO.Swagger.Api /// public UserApi(String basePath) { - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; this.SetBasePath(basePath); } @@ -203,7 +203,7 @@ namespace IO.Swagger.Api public UserApi(Configuration configuration = null) { if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.DefaultConfiguration; + this.Configuration = Configuration.Default; else this.Configuration = configuration; } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs index 4aadca23673..1d511e7624b 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs @@ -29,6 +29,12 @@ namespace IO.Swagger.Client BasePath = basePath; RestClient = new RestClient(BasePath); } + + /// + /// Gets or sets the default API client for making HTTP calls. + /// + /// The default API client. + public static ApiClient Default = new ApiClient(); /// /// Gets or sets the base path. diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs index a1b79cec0c5..a25a2d28fbf 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs @@ -12,6 +12,17 @@ namespace IO.Swagger.Client /// public class Configuration { + /// + /// Initializes a new instance of the Configuration class. + /// + /// Api client. + public Configuration(ApiClient apiClient=null) + { + if (apiClient == null) + ApiClient = ApiClient.Default; + else + ApiClient = apiClient; + } /// /// Version of the package. @@ -20,16 +31,16 @@ namespace IO.Swagger.Client public const string Version = "1.0.0"; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the default Configuration. /// - /// The API client. - public static Configuration DefaultConfiguration = new Configuration(); + /// Configuration. + public static Configuration Default = new Configuration(); /// /// Gets or sets the default API client for making HTTP calls. /// /// The API client. - public ApiClient ApiClient = new ApiClient(); + public ApiClient ApiClient; /// /// Gets or sets the username (HTTP basic authentication). diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index cd6170dd2e8..2774e9b7536 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -1,9 +1,28 @@  - + - + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestConfiguration.cs index 9a41dbbbf38..177fd5bf53f 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestConfiguration.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestConfiguration.cs @@ -27,7 +27,7 @@ namespace SwaggerClient.TestConfiguration { PetApi p = new PetApi ("http://new-basepath.com"); Assert.AreEqual (p.Configuration.ApiClient.BasePath, "http://new-basepath.com"); - Assert.AreSame (p.Configuration, Configuration.DefaultConfiguration); + Assert.AreSame (p.Configuration, Configuration.Default); } @@ -38,7 +38,7 @@ namespace SwaggerClient.TestConfiguration PetApi p2 = new PetApi (); Assert.AreSame (p1.Configuration, p2.Configuration); // same as the default - Assert.AreSame (p1.Configuration, Configuration.DefaultConfiguration); + Assert.AreSame (p1.Configuration, Configuration.Default); Configuration c = new Configuration (); Assert.AreNotSame (c, p1.Configuration); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll index e26e6d019c2..70db74529f5 100755 Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll differ diff --git a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb index c798dc28827..dbafd969d6c 100644 Binary files a/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb differ diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll index e26e6d019c2..70db74529f5 100755 Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll differ diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb index c798dc28827..dbafd969d6c 100644 Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb and b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb differ