Nswag: Antipaterns in c# code generation

Created on 2 Feb 2018  路  5Comments  路  Source: RicoSuter/NSwag

When generating c# client code the created code uses a few not recommend solutions for writing c# apps.
First https://docs.microsoft.com/en-us/azure/architecture/antipatterns/improper-instantiation/
There should be a way of controlling the HttpClient creation like a virtual method GetHttpClient.
Also serialization of json is somewhat unoptimized https://www.newtonsoft.com/json/help/html/Performance.htm
You should also add a method for serialization and deserialization.

help wanted enhancement

Most helpful comment

All 5 comments

Good stuff thanks for sharing!

There are already many ways to control how HttpClient is used (e.g. InjectHttpClient, DisposeHttpClient, UseHttpClientCreationMethod, HttpClientType). Improving JSON serialization would be great...

Also see https://github.com/RSuter/NSwag/issues/1097

@RSuter Thanks I don't know how I missed the setting sorry about that.

Closing as there are already enough settings to completely control that and also use HttpClientFactory

Was this page helpful?
0 / 5 - 0 ratings