예제 #1
0
        protected override async Task ExecuteAsync(CancellationToken stopToken)
        {
            DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder <TaxiStationContext>();

            DbContextOptions <TaxiStationContext> options = (DbContextOptions <TaxiStationContext>)optionsBuilder
                                                            .UseSqlServer("Data Source=DESKTOP-074QD8U;Initial Catalog=TaxiStation;Persist Security Info=True;User ID=GENIUS_DATABASE_12345;Password=12345")
                                                            .Options;

            using (TaxiStationContext context = new TaxiStationContext(options))
            {
                //Do your preparation (e.g. Start code) here
                while (!stopToken.IsCancellationRequested)
                {
                    await context.Database.CanConnectAsync();

                    Thread.Sleep(10_000);
                    // await DoSomethingAsync();
                }
                //Do your cleanup (e.g. Stop code) here
            }
        }
 public OrdersController(TaxiStationContext context)
 {
     _context = context;
 }
예제 #3
0
 public VenichlesController(TaxiStationContext context)
 {
     _context = context;
 }
 public TurnsController(TaxiStationContext context)
 {
     _context = context;
 }