/// <summary> /// Returns a task that is completed when the specified action is complete. /// </summary> /// <param name="context"></param> /// <param name="action"></param> /// <param name="cancellationToken"></param> /// <returns></returns> async Task ExecuteActionAsync(SqlDeploymentExecuteContext context, SqlDeploymentAction action, CancellationToken cancellationToken) { context.Logger.LogDebug("Starting action {Action} against {InstanceName}.", action.GetType().Name, action.InstanceName); await action.ExecuteAsync(context, cancellationToken); context.Logger.LogDebug("Finished action {Action} against {InstanceName}.", action.GetType().Name, action.InstanceName); }
/// <summary> /// Adds a new action to the stack of actions to be executed. /// </summary> /// <param name="action"></param> public void AddAction(SqlDeploymentAction action) { }
/// <summary> /// Returns a task that is completed when the specified action is complete. /// </summary> /// <param name="context"></param> /// <param name="action"></param> /// <param name="cancellationToken"></param> /// <returns></returns> Task ExecuteAsync(SqlDeploymentExecuteContext context, SqlDeploymentAction action, CancellationToken cancellationToken) { return(tasks.GetOrAdd(action, _ => new Lazy <AsyncJob <bool> >(() => new AsyncJob <bool>(async ct => { await ExecuteActionAsync(context, _, ct); return true; }), true)).Value.WaitAsync(cancellationToken)); }