public ImportController( RedisService redis, DbService db, ArtistService artistService, ImporterService importer, ScheduledService scheduledService ) : base(redis, db, artistService) { _scheduledService = scheduledService; _importer = importer; }
public ImportController( RedisService redis, DbService db, ArtistService artistService, ImporterService importer, ScheduledService scheduledService, IConfiguration configuration ) : base(redis, db, artistService) { _configuration = configuration; _scheduledService = scheduledService; _importer = importer; }
public static void ScheduleBus(BusContext db, string busNumber, string routeName) { //pretend this is in a repository var bus = Bus.FromMemento(db.Buses.Single(b => b.BusNumber == busNumber)); var route = BusRoute.FromMemento(db.BusRoutes.Single(r => r.Id == int.Parse(routeName))); var schedule = new ScheduledService(new ScheduledServiceId(Guid.NewGuid()), bus.Id, route.Id); if (busNumber.StartsWith("A")) { schedule.Activate(); } db.Services.Add(schedule.State); db.SaveChanges(); }
protected override async Task RunAsync(CancellationToken cancellationToken) { await base.RunAsync(cancellationToken); using (ILifetimeScope scope = _container.BeginLifetimeScope()) { var impl = scope.Resolve <TServiceImplementation>(); var telemetryClient = scope.Resolve <TelemetryClient>(); var logger = scope.Resolve <ILogger <DelegatedActorService <TServiceImplementation, TActorImplementation> > >(); await Task.WhenAll( impl.RunAsync(cancellationToken), ScheduledService.RunScheduleAsync(impl, telemetryClient, cancellationToken, logger)); } }