/
Introduction of a service provider

Introduction of a service provider

Using a dependency injection pattern in order to inject all services we need regarding processes :

  • logging process

  • repository layer containing repo to dataverse and repo to power BI service

  • connexion to dataverse and to power BI service

public static IHostBuilder CreateHostBuilder(string[] strings, IContextServicePowerPlatform contextServicePowerPlatform, IContextServicePowerBI contextServicePowerBI, IContextServiceDataMappingPowerPlatform contextServiceDataMappingPowerPlatform) { return Host.CreateDefaultBuilder() .ConfigureServices((_, services) => { services.AddSingleton<LoggerMessage>(); //PowerPlatform environment as Target services.AddSingleton<DataverseRepository<DataverseModel.SystemForm>>(new SystemFormRepository(contextServicePowerPlatform)); //PowerPlatform environment as Data Mapping services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.Account>>(new DataMappingAccountRepository(contextServiceDataMappingPowerPlatform)); services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.AmPlc_DataMappingEntityForms>>(new DataMappingEntityFormsRepository(contextServiceDataMappingPowerPlatform)); services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.AmPlc_DataMappingPowerBi>>(new DataMappingPowerBiRepository(contextServiceDataMappingPowerPlatform)); services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.AmPlc_ProjectMarketingFAcTuRation>>(new DataMappingProjectMarketingFacturationRepository(contextServiceDataMappingPowerPlatform)); services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.AmPlc_DataMappingPowerPlatform>>(new DataMappingPowerPlatformRepository(contextServiceDataMappingPowerPlatform)); services.AddSingleton<DataverseDataMappingRepository<DataverseDataMappingModel.AmPlc_DataMappingLog>>(new DataMappingLogRepository(contextServiceDataMappingPowerPlatform)); //PowerBI Service & Workspace / GroupId services.AddSingleton<PowerBiRepository<Group>>(new GroupRepository(contextServicePowerBI)); services.AddSingleton<PowerBiRepository<Report>>(new ReportRepository(contextServicePowerBI)); }); }