'How do I access .NET Core configuration from the WCF ConfigureEndpoint partial method?
I'm a little confused and just want verification. I've created a .NET 6 Web Api project. It needs to call an existing WCF service, so I've added that via Connected Services. I'm using the options pattern to get my url from my json appSettings files and it works just fine to overwrite the address when I instantiate the client that Connected Services created for me.
However, it's recommended to use the partial method the generated code gives you "ConfigureEndpoint". I'm already using this to inject some things into the SOAP header that my existing WCF service is expecting. However I see Microsoft and other posts telling me I should do my address change here as well. It makes sense to me since then I don't have to do it on ever instantiation of the client. However there's really no way to inject it, right? Does that mean I'm left with creating a custom static class to access the configuration? That's the only way I can think of to get access to the configuration from the ConfigureEndpoint partial method the generated code gives you.
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
