using CMSMicroservice.Protobuf.Protos.OtpToken; using CMSMicroservice.Protobuf.Protos.Package; using CMSMicroservice.Protobuf.Protos.Products; using CMSMicroservice.Protobuf.Protos.ProductGallerys; using CMSMicroservice.Protobuf.Protos.ProductImages; using CMSMicroservice.Protobuf.Protos.User; using CMSMicroservice.Protobuf.Protos.UserAddress; using CMSMicroservice.Protobuf.Protos.UserCarts; using CMSMicroservice.Protobuf.Protos.UserContract; using CMSMicroservice.Protobuf.Protos.UserOrder; using CMSMicroservice.Protobuf.Protos.UserWallet; using CMSMicroservice.Protobuf.Protos.UserWalletChangeLog; using FrontOffice.BFF.Application.Common.Interfaces; using Microsoft.Extensions.DependencyInjection; using PYMSMicroservice.Protobuf.Protos.Transaction; namespace FrontOffice.BFF.Infrastructure.Services; public class ApplicationContractContext : IApplicationContractContext { #region members private readonly IServiceProvider _serviceProvider; #endregion #region utilities private T GetService() where T : Grpc.Core.ClientBase { return _serviceProvider.GetService() ?? throw new Exception($"requested service not registered: {typeof(T).FullName}"); } #endregion public ApplicationContractContext(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; } #region FM //public FileLogContract.FileLogContractClient FileManagements => GetService(); #endregion #region CMS public PackageContract.PackageContractClient Package => GetService(); public ProductsContract.ProductsContractClient Product => GetService(); public ProductGallerysContract.ProductGallerysContractClient ProductGallerys => GetService(); public ProductImagesContract.ProductImagesContractClient ProductImages => GetService(); public UserCartsContract.UserCartsContractClient UserCart => GetService(); public UserContract.UserContractClient User => GetService(); public UserContractContract.UserContractContractClient UserContract => GetService(); public UserAddressContract.UserAddressContractClient UserAddress => GetService(); public UserOrderContract.UserOrderContractClient UserOrder => GetService(); public OtpTokenContract.OtpTokenContractClient OtpToken => GetService(); public UserWalletContract.UserWalletContractClient UserWallet => GetService(); public UserWalletChangeLogContract.UserWalletChangeLogContractClient UserWalletChangeLog => GetService(); #endregion #region PYMS public TransactionContract.TransactionContractClient ZarinTransactions => GetService(); #endregion }