Example #1
0
        /// <inheritdoc />
        public Action <IApplicationBuilder> Configure(Action <IApplicationBuilder> next)
        {
            Ensure.IsNotNull(next, nameof(next));

            // MA - Execute any startup tasks.
            _executor.ExecuteStartupTasksAsync().GetAwaiter().GetResult();

            // MA - Attach to the application lifetime to trigger any shutdown tasks.
            _applicationLifetime.ApplicationStopped.Register(() =>
                                                             _executor.ExecuteShutdownTasksAsync().GetAwaiter().GetResult());

            return(next);
        }