36 lines
869 B
C#
36 lines
869 B
C#
|
|
using FrontOffice.BFF.Application.Common.Interfaces;
|
||
|
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
|
||
|
|
namespace FrontOffice.BFF.Infrastructure.Services;
|
||
|
|
|
||
|
|
public class ApplicationContractContext : IApplicationContractContext
|
||
|
|
{
|
||
|
|
#region members
|
||
|
|
|
||
|
|
private readonly IServiceProvider _serviceProvider;
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
|
||
|
|
#region utilities
|
||
|
|
|
||
|
|
private T GetService<T>() where T : Grpc.Core.ClientBase<T>
|
||
|
|
{
|
||
|
|
return _serviceProvider.GetService<T>() ??
|
||
|
|
throw new Exception($"requested service not registered: {typeof(T).FullName}");
|
||
|
|
}
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
public ApplicationContractContext(IServiceProvider serviceProvider)
|
||
|
|
{
|
||
|
|
_serviceProvider = serviceProvider;
|
||
|
|
}
|
||
|
|
|
||
|
|
#region FM
|
||
|
|
|
||
|
|
//public FileLogContract.FileLogContractClient FileManagements => GetService<FileLogContract.FileLogContractClient>();
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
}
|