Skip to content

Commit aef5d30

Browse files
Dev/allancascante/deploy operation/notification fixes (#2546)
1 parent 15c97be commit aef5d30

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

src/Microsoft.SqlTools.ServiceLayer/DacFx/Contracts/DacFxRequest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ public abstract class DacFxParams : IScriptableRequestParams
4141
public class DacFxResult : ResultStatus
4242
{
4343
public string OperationId { get; set; }
44+
public string OperationType { get; internal set; }
4445
}
4546
}

src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,15 @@ private void ExecuteOperation(DacFxOperation operation, DacFxParams parameters,
369369

370370
// put appropriate database name since connection passed was to master
371371
metadata.DatabaseName = parameters.DatabaseName;
372+
metadata.OperationName = operation.GetType().Name;
372373
operation.SqlTask = SqlTaskManagerInstance.CreateTask<SqlTask>(metadata);
373374

374375
await operation.SqlTask.RunAsync();
375376
await requestContext.SendResult(new DacFxResult()
376377
{
377378
OperationId = operation.OperationId,
378379
Success = operation.SqlTask.TaskStatus == SqlTaskStatus.Succeeded,
379-
ErrorMessage = string.Empty
380+
ErrorMessage = string.Empty,
380381
});
381382
}
382383
catch (Exception e)
@@ -385,7 +386,7 @@ await requestContext.SendResult(new DacFxResult()
385386
{
386387
OperationId = operation.OperationId,
387388
Success = false,
388-
ErrorMessage = e.Message
389+
ErrorMessage = e.Message,
389390
});
390391
}
391392
});

src/Microsoft.SqlTools.ServiceLayer/TaskServices/Contracts/TaskInfo.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ public class TaskInfo
4242
/// </summary>
4343
public string TargetLocation { get; set; }
4444

45+
/// <summary>
46+
/// Target operation name for this task, used to distinguish between operations
47+
/// so invokers can get actions based on the type being performed
48+
/// </summary>
49+
public string OperationName { get; set; }
50+
4551
/// <summary>
4652
/// Task name which defines the type of the task (e.g. CreateDatabase, Backup)
4753
/// </summary>

src/Microsoft.SqlTools.ServiceLayer/TaskServices/SqlTask.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ public TaskInfo ToTaskInfo()
477477
TaskExecutionMode = TaskMetadata.TaskExecutionMode,
478478
IsCancelable = this.TaskToCancel != null,
479479
TargetLocation = TaskMetadata.TargetLocation,
480+
OperationName = TaskMetadata.OperationName
480481
};
481482
}
482483

src/Microsoft.SqlTools.ServiceLayer/TaskServices/TaskMetadata.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public class TaskMetadata
5858
/// </summary>
5959
public string OwnerUri { get; set; }
6060

61+
/// <summary>
62+
/// Operation name for this task, used to distinguish between operations
63+
/// so invokers can get actions based on the type being performed
64+
/// </summary>
65+
public string OperationName { get; internal set; }
66+
6167
/// <summary>
6268
/// Creates task metadata given the request parameters
6369
/// </summary>

0 commit comments

Comments
 (0)