public async Task <string> GetQuoteAsync()
 {
     return(await Policy <string>
            .Handle <Exception>()
            .FallbackAsync(_config.Value.FailedMessage)
            .WrapAsync(_apiCallPolicy)
            .ExecuteAsync(async() =>
     {
         var uri = await _discoveryClient.LookupServiceAsync(new Uri("http://FunnyQuotesLegacyService/FunnyQuoteserviceWCF.svc"));
         var wcfClient = new FunnyQuoteServiceClient(FunnyQuoteServiceClient.EndpointConfiguration.BasicHttpBinding_IFunnyQuoteService, uri.ToString());
         return await wcfClient.GetQuoteAsync();
     }));
 }
示例#2
0
 public FunnyQuoteServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(FunnyQuoteServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#3
0
 public FunnyQuoteServiceClient(EndpointConfiguration endpointConfiguration) :
     base(FunnyQuoteServiceClient.GetBindingForEndpoint(endpointConfiguration), FunnyQuoteServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#4
0
 public FunnyQuoteServiceClient() :
     base(FunnyQuoteServiceClient.GetDefaultBinding(), FunnyQuoteServiceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IFunnyQuoteService.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#5
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(FunnyQuoteServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IFunnyQuoteService));
 }
示例#6
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(FunnyQuoteServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IFunnyQuoteService));
 }