private void Initialize() { var configBuilder = new ConfigurationBuilder().AddJsonFile(_configFileName); var config = configBuilder.Build(); geocodingClient = new GeocodingClient <GeocodingResponse>(new ApiClient(new ApiContext { OutputFormat = config["GoogleApi:OutputFormat"], ApiKey = config["GoogleApi:GeocodingApiKey"], HostName = config["GoogleApi:HostName"], Path = config["GoogleApi:Path"], Protocol = config["GoogleApi:Protocol"], ApiMethod = config["GoogleApi:GeocodingMethod"] }, new RateGate(1, TimeSpan.FromSeconds(5)), new JsonResponseConverter())); distanceMatrixClient = new DistanceMatrixClient <DistanceMatrixResponse>(new ApiClient(new ApiContext { OutputFormat = config["GoogleApi:OutputFormat"], ApiKey = config["GoogleApi:DistanceMatixApiKey"], HostName = config["GoogleApi:HostName"], Path = config["GoogleApi:Path"], Protocol = config["GoogleApi:Protocol"], ApiMethod = config["GoogleApi:DistanceMatrixMethod"] }, new RateGate(1, TimeSpan.FromSeconds(5)), new JsonResponseConverter())); }