private void ExecuteOperation(DacFxOperation operation, DacFxParams parameters, string taskName, RequestContext <DacFxResult> requestContext) { Task.Run(async() => { try { TaskMetadata metadata = TaskMetadata.Create(parameters, taskName, operation, ConnectionServiceInstance); // put appropriate database name since connection passed was to master metadata.DatabaseName = parameters.DatabaseName; SqlTask sqlTask = SqlTaskManagerInstance.CreateTask <SqlTask>(metadata); await sqlTask.RunAsync(); await requestContext.SendResult(new DacFxResult() { OperationId = operation.OperationId, Success = sqlTask.TaskStatus == SqlTaskStatus.Succeeded, ErrorMessage = string.Empty }); } catch (Exception e) { await requestContext.SendResult(new DacFxResult() { OperationId = operation.OperationId, Success = false, ErrorMessage = e.Message }); } }); }
private async Task ExecuteOperation(DacFxOperation operation, DacFxParams parameters, string taskName, RequestContext <DacFxResult> requestContext) { SqlTask sqlTask = null; TaskMetadata metadata = TaskMetadata.Create(parameters, taskName, operation, ConnectionServiceInstance); // put appropriate database name since connection passed was to master metadata.DatabaseName = parameters.DatabaseName; sqlTask = SqlTaskManagerInstance.CreateAndRun <SqlTask>(metadata); await requestContext.SendResult(new DacFxResult() { OperationId = operation.OperationId, Success = true, ErrorMessage = string.Empty }); }