Skip to content

I would like to be able to specify different endpoints for code generation and run-time. #49

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

Open
ElephantsGerald opened this issue May 22, 2015 · 4 comments

Comments

@ElephantsGerald
Copy link

The configured endpoint URL gets hard-coded as the value of a static variable (MyWebApiProxyBaseAddress) in the generated .cs file.

I need to be able to generate the proxy against a development endpoint, but target different endpoints at run-time (i.e. so I can move my app through QA, UAT and into a Live environment): the runtime configuration shouldn't require re-generation and re-compilation.

Nice work BTW :-)

@bogdanvarlamov
Copy link

I agree that it would be a lot easier to use if it were a config file setting.

@tjeerdhans
Copy link

I solved this by adding a partial class 'WebApiConfiguration.partial.cs' which sets the base address in its constructor.

using System.Configuration;

namespace WebApi.Proxies
{
    /// <summary>
    /// Partial class for the Web API Proxy client configuration. 
    /// </summary>
    public partial class Configuration
    {
        static Configuration()
        {
            MyWebApiProxyBaseAddress = ConfigurationManager.ConnectionStrings["QdcWebApiBaseAddress"].ConnectionString;
        }
    }
}

@faniereynders
Copy link
Member

Something similar was proposed in #24 for the same problem. Merging this into one.

@faniereynders
Copy link
Member

Sorry closed the wrong issue. As you were.

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

No branches or pull requests

4 participants