1234567891011121314151617181920212223242526 |
- using Microsoft.Extensions.DependencyInjection;
- using Sharing.Province.Dtos;
- using XF.Domain.Dependency;
- namespace Sharing.Province;
- public class XieTongClient : ProvinceClient, ISingletonDependency, ISelfDependency
- {
- private readonly IServiceScopeFactory _scopeFactory;
- public XieTongClient(IServiceScopeFactory scopeFactory) : base(scopeFactory)
- {
- _scopeFactory = scopeFactory;
- }
- public Task<TResponse?> RequestAsync<TRequest, TResponse>(TRequest request, CancellationToken cancellationToken)
- where TRequest : IProvinceRequest, new()
- {
- using var scope = _scopeFactory.CreateScope();
- var provider = scope.ServiceProvider;
- var channelconfigManager = provider.GetRequiredService<IChannelConfigurationManager>();
- var configProvince = channelconfigManager.GetConfigurationProvince();
- return base.RequestAsync<TRequest, TResponse>(request, configProvince.XieTong, configProvince, cancellationToken);
- }
- }
|