-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSharpClientGeneratorSettings
Milan Jaroš edited this page Feb 5, 2020
·
5 revisions
- Package: NSwag.CodeGeneration.CSharp
- Class: CSharpClientGeneratorSettings.cs
Inherits CSharpGeneratorBaseSettings
Properties:
- ClientBaseClass: Full name of the base class (empty for no base class).
-
ConfigurationClass: Specifies the name of the configuration class (see below, requires setting the
ClientBaseClass
) - GenerateExceptionClasses: Specifies whether to generate exception classes (default: true).
-
ExceptionClass: The name of the generated exception classes (default 'SwaggerException', may use
{controller}
placeholder). - InjectHttpClient: Inject the HttpClient via constructor so that its lifetime can be handled externally (default: true).
- DisposeHttpClient: Specifies whether to dispose the HttpClient (injected HttpClient is never disposed).
-
ProtectedMethods: List of methods with a protected access modifier (
classname.methodname
). -
UseHttpClientCreationMethod: Indicates whether to call
CreateHttpClientAsync
on the base class to create anew HttpClient
instance (ClientBaseClass
must be defined). -
UseHttpRequestMessageCreationMethod: Indicates whether to call
CreateHttpRequestMessageAsync
on the base class to create a newHttpRequestMessage
(ClientBaseClass must be defined). - WrapDtoExceptions: Specifies whether DTO exceptions are wrapped in a SwaggerException instance (default: true).
- ClientClassAccessModifier: The client class access modifier (default: public).
- UseBaseUrl: Specifies whether to use and expose the base URL (default: true).
- GenerateBaseUrlProperty: Specifies whether to generate the BaseUrl property, must be defined on the base class otherwise (default: true).
- GenerateSyncMethods: Specifies whether to generate synchronous methods (not recommended, default: false).
- HttpClientType: Specifies the HttpClient type. By default the 'System.Net.Http.HttpClient' is used.
- ParameterDateTimeFormat: Specifies the format for DateTime type method parameters (default: s).
- GenerateUpdateJsonSerializerSettingsMethod: Generate the UpdateJsonSerializerSettings method (must be implemented in the base class otherwise, default: true)
- UseRequestAndResponseSerializationSettings: Value indicating whether to generate different request and response serialization settings (default: false).
-
SerializeTypeInformation: Indicates whether the generated client will automatically use
TypeNameHandling.Auto
property of theNewtonsoft.Json
serializer. Furthermore, this option will update the generated client code for the correct use of the property. For more information about the property see: Newtonsoft.Json documentation - QueryNullValue: The null value used for query parameters which are null (default: '').
- ExposeJsonSerializerSettings: Specifies whether to expose the JsonSerializerSettings property (default: false).