Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nswag custom ctor #5030

Open
bali406 opened this issue Nov 20, 2024 · 0 comments
Open

Nswag custom ctor #5030

bali406 opened this issue Nov 20, 2024 · 0 comments

Comments

@bali406
Copy link

bali406 commented Nov 20, 2024

NSwag generated client with custom constructor

Is it possible to use nswag an generate custom constructor with additional param. When I run nswag to generate api client, I got this ctor:

WeatherClient(IConfiguration configuration, HttpClient httpClient)

how can I generate api client with this constructor:

WeatherClient(IConfiguration configuration, HttpClient httpClient, IMemoryCache memoryCache)

I know in nswag file I can set configuration class but how can I configure so I can have IMemoryCache injected in this generated client.

I am using command line tool to generate the client. I tried liquid templates client.class.contructor but it add to the ctor but doesn't replace it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant