Exemplo n.º 1
0
        private async Task StopAll()
        {
            Log.Information("Disposing all");
            try
            {
                await _container.DisposeAsync().AsTask();

                Log.Information("Disposed all");
            }
            catch (Exception e)
            {
                Log.Error(e, "Dispose all failed");
            }

            await Task.Delay(400); // wait for everything is done.

            Log.Information("Closing connection");
            await Task.Run(() => Log.CloseAndFlush());

            // no loging after this point

            if (_hubConnectionService.Connection != null)
            {
                await _hubConnectionService.Connection.DisposeAsync();
            }

            await _mainVpnModel.StopAsync();
        }
Exemplo n.º 2
0
        protected override void Dispose(bool disposing)
        {
            // Dispose the hub lifetime scope when the hub is disposed.
            if (disposing)
            {
                HubScope.DisposeAsync();
            }

            base.Dispose(disposing);
        }
Exemplo n.º 3
0
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing)
            {
                await _rootLifetimeScope.DisposeAsync();

                // Registries are not likely to have async tasks to dispose of,
                // so we will leave it as a straight dispose.
                ComponentRegistry.Dispose();
            }

            // Do not call the base, otherwise the standard Dispose will fire.
        }
Exemplo n.º 4
0
 public override void Destroy()
 {
     base.Destroy();
     AutofacScope?.DisposeAsync();
 }
Exemplo n.º 5
0
        public async Task Close_container()
        {
            await _scope.DisposeAsync();

            await _container.DisposeAsync();
        }
 public ValueTask DisposeAsync()
 {
     return(_lifetimeScope.DisposeAsync());
 }