Open tasutafat opened 1 year ago
Hello,
on a technical level: The overhead to create multiple Translators itself is pretty low, the only thing is that multiple Translator
objects would create multiple HTTP sessions (which is a bit of overhead).
I think the main question here is just an architectural decision. By default I would lean towards creating a single Translator which you can expose to your Application as a singleton or something similar.
Thank you very much for your response! I will add it to my Service collection!
@daniel-jones-deepl, @JanEbbing, would you evaluate the possibility to add some service collection extensions? I wrote a small POC in this PR #28.
Hey @antoniovalentini
Is this what you had in mind?
https://github.com/DeepLcom/deepl-dotnet/blob/issue-26%2B29/src/DeepL.Service/DeepLService.cs
How to use it: https://github.com/DeepLcom/deepl-dotnet/blob/75fd2c6c062ef2c9ab145d953d7ede79f419fd07/samples/ASP.NET/Program.cs#L19
Hey @DeeJayTC, yes that's what I had in mind. Since you're integrating this into the development branch, I think my PR is not useful anymore. Should I close it?
Yea, i alread had it sitting here unfinished. Your PR reminded me to get it done! 😇
Hello there, I was just wondering if it makes sense to create one Translator and use dependency injection to get it to the classes it's needed in or if there should be a new Translator each time it is needed?
Best regards, tasutafat