RemoteServiceOptions to AbpRemoteServiceOptions

pull/1919/head
Yunus Emre Kalkan 6 years ago
parent f9e97319fb
commit 15a79928a0

@ -24,7 +24,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// <param name="assembly">The assembly containing the service interfaces</param>
/// <param name="remoteServiceConfigurationName">
/// The name of the remote service configuration to be used by the HTTP Client proxies.
/// See <see cref="RemoteServiceOptions"/>.
/// See <see cref="AbpRemoteServiceOptions"/>.
/// </param>
/// <param name="asDefaultServices">
/// True, to register the HTTP client proxy as the default implementation for the services.
@ -63,7 +63,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// <param name="services">Service collection</param>
/// <param name="remoteServiceConfigurationName">
/// The name of the remote service configuration to be used by the HTTP Client proxy.
/// See <see cref="RemoteServiceOptions"/>.
/// See <see cref="AbpRemoteServiceOptions"/>.
/// </param>
/// <param name="asDefaultService">
/// True, to register the HTTP client proxy as the default implementation for the service <typeparamref name="T"/>.
@ -87,7 +87,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// <param name="type">Type of the service</param>
/// <param name="remoteServiceConfigurationName">
/// The name of the remote service configuration to be used by the HTTP Client proxy.
/// See <see cref="RemoteServiceOptions"/>.
/// See <see cref="AbpRemoteServiceOptions"/>.
/// </param>
/// <param name="asDefaultService">
/// True, to register the HTTP client proxy as the default implementation for the service <paramref name="type"/>.

@ -17,7 +17,7 @@ namespace Volo.Abp.Http.Client
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<RemoteServiceOptions>(configuration);
Configure<AbpRemoteServiceOptions>(configuration);
}
}
}

@ -1,10 +1,10 @@
namespace Volo.Abp.Http.Client
{
public class RemoteServiceOptions
public class AbpRemoteServiceOptions
{
public RemoteServiceConfigurationDictionary RemoteServices { get; set; }
public RemoteServiceOptions()
public AbpRemoteServiceOptions()
{
RemoteServices = new RemoteServiceConfigurationDictionary();
}

@ -34,7 +34,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
protected AbpCorrelationIdOptions AbpCorrelationIdOptions { get; }
protected IDynamicProxyHttpClientFactory HttpClientFactory { get; }
protected IApiDescriptionFinder ApiDescriptionFinder { get; }
protected RemoteServiceOptions RemoteServiceOptions { get; }
protected AbpRemoteServiceOptions AbpRemoteServiceOptions { get; }
protected AbpHttpClientOptions ClientOptions { get; }
protected IJsonSerializer JsonSerializer { get; }
protected IRemoteServiceHttpClientAuthenticator ClientAuthenticator { get; }
@ -51,7 +51,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
public DynamicHttpProxyInterceptor(
IDynamicProxyHttpClientFactory httpClientFactory,
IOptions<AbpHttpClientOptions> clientOptions,
IOptionsSnapshot<RemoteServiceOptions> remoteServiceOptions,
IOptionsSnapshot<AbpRemoteServiceOptions> remoteServiceOptions,
IApiDescriptionFinder apiDescriptionFinder,
IJsonSerializer jsonSerializer,
IRemoteServiceHttpClientAuthenticator clientAuthenticator,
@ -69,7 +69,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
JsonSerializer = jsonSerializer;
ClientAuthenticator = clientAuthenticator;
ClientOptions = clientOptions.Value;
RemoteServiceOptions = remoteServiceOptions.Value;
AbpRemoteServiceOptions = remoteServiceOptions.Value;
Logger = NullLogger<DynamicHttpProxyInterceptor<TService>>.Instance;
}
@ -129,7 +129,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
private async Task<string> MakeRequestAsync(IAbpMethodInvocation invocation)
{
var clientConfig = ClientOptions.HttpClientProxies.GetOrDefault(typeof(TService)) ?? throw new AbpException($"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}.");
var remoteServiceConfig = RemoteServiceOptions.RemoteServices.GetConfigurationOrDefault(clientConfig.RemoteServiceName);
var remoteServiceConfig = AbpRemoteServiceOptions.RemoteServices.GetConfigurationOrDefault(clientConfig.RemoteServiceName);
var client = HttpClientFactory.Create(clientConfig.RemoteServiceName);
@ -241,8 +241,8 @@ namespace Volo.Abp.Http.Client.DynamicProxying
var clientConfig = ClientOptions.HttpClientProxies.GetOrDefault(typeof(TService))
?? throw new AbpException($"Could not get DynamicHttpClientProxyConfig for {typeof(TService).FullName}.");
return RemoteServiceOptions.RemoteServices.GetOrDefault(clientConfig.RemoteServiceName)?.Version
?? RemoteServiceOptions.RemoteServices.Default?.Version;
return AbpRemoteServiceOptions.RemoteServices.GetOrDefault(clientConfig.RemoteServiceName)?.Version
?? AbpRemoteServiceOptions.RemoteServices.Default?.Version;
}
private async Task ThrowExceptionForResponseAsync(HttpResponseMessage response)

@ -57,7 +57,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning
context.Services.AddHttpClientProxies(typeof(AbpAspNetCoreMvcVersioningTestModule).Assembly);
Configure<RemoteServiceOptions>(options =>
Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default = new RemoteServiceConfiguration("/");
});

@ -18,7 +18,7 @@ namespace Volo.Abp.Http
context.Services.AddHttpClientProxies(typeof(TestAppModule).Assembly);
context.Services.AddHttpClientProxy<IRegularTestController>();
Configure<RemoteServiceOptions>(options =>
Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default = new RemoteServiceConfiguration("/");
});

Loading…
Cancel
Save