public override void Dispose()
 {
     if (!isDisposed)
     {
         isDisposed = true;
         base.Dispose();
         if (RealDbContext != null)
         {
             RealDbContext.Dispose();
             RealDbContext = null;
         }
     }
 }
Exemplo n.º 2
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation($"1. {nameof(StartAsync)} has been called.");

            _logger.LogInformation($"Migrating database ...");
            var dbContext = new RealDbContext(_sqlConnectionManager);
            await dbContext.Database.MigrateAsync(cancellationToken);

            _logger.LogInformation($"Migration done ...");


            //_logger.LogInformation($"Registering new user ...");

            //var scope = _mediatorFactory.CreateScope();
            //var result = await scope.SendAsync(RegisterUserMediatorCommand.CreateCommand("", "Olivier", "Verplancke", "demo"), cancellationToken);

            await _dbContext.SaveChangesAsync(cancellationToken);

            //_logger.LogInformation($"User was registered with Id: {result.Id}");
        }
Exemplo n.º 3
0
 public VilleRepository(RealDbContext context)
 {
     this.context = context;
 }