protected override Task ProcessInScope(IServiceProvider serviceProvider) { using (var scope = _serviceScopeFactory.CreateScope()) { var limsDbContext = scope.ServiceProvider.GetService <LimsDbContext>(); var coreDbContext = scope.ServiceProvider.GetService <CoreDbContext>(); var migrationDbContext = scope.ServiceProvider.GetService <MigrationDbContext>(); var mapper = scope.ServiceProvider.GetService <IObjectMapper>(); var commonRep = new CommonRepository(coreDbContext, null, null); var dataService = new CommonDataService(commonRep, null); var limsRep = new LimsRepository(null, null, limsDbContext, null); var limsExchangeService = new LimsExchangeService(limsRep, dataService, null, mapper, migrationDbContext, null, null, null); Task.WaitAll(limsExchangeService.ImportLimsDepartmentalSubordination()); } return(Task.CompletedTask); }