diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/Contracts/SavePublishProfileRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/Contracts/SavePublishProfileRequest.cs
index 132e1163..15e15207 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/Contracts/SavePublishProfileRequest.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/Contracts/SavePublishProfileRequest.cs
@@ -2,6 +2,8 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
+
+#nullable disable
using System.Collections.Generic;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
@@ -21,22 +23,22 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
///
/// Gets or sets name for database
///
- public string? DatabaseName { get; set; }
+ public string DatabaseName { get; set; }
///
/// Gets or sets target connection string
///
- public string? ConnectionString { get; set; }
+ public string ConnectionString { get; set; }
///
/// Gets or sets SQLCMD variables for deployment
///
- public IDictionary? SqlCommandVariableValues { get; set; }
+ public IDictionary SqlCommandVariableValues { get; set; }
///
/// Gets or sets the options for deployment
///
- public DeploymentOptions? DeploymentOptions { get; set; }
+ public DeploymentOptions DeploymentOptions { get; set; }
}
///
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxService.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxService.cs
index 375f5c8e..79b817ed 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxService.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxService.cs
@@ -26,8 +26,6 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
///
class DacFxService
{
- private static ConnectionService connectionService = null;
- private SqlTaskManager sqlTaskManagerInstance = null;
private static readonly Lazy instance = new Lazy(() => new DacFxService());
private static Version? serviceVersion = LoadServiceVersion();
private const string TelemetryDefaultApplicationName = "sqltoolsservice";
@@ -105,7 +103,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
/// Handles request to import a bacpac
///
///
- public async Task HandleImportRequest(ImportParams parameters, RequestContext requestContext)
+ public Task HandleImportRequest(ImportParams parameters, RequestContext requestContext)
{
ConnectionInfo connInfo;
ConnectionServiceInstance.TryFindConnection(
@@ -116,6 +114,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
ImportOperation operation = new ImportOperation(parameters, connInfo);
ExecuteOperation(operation, parameters, SR.ImportBacpacTaskName, requestContext);
}
+ return Task.CompletedTask;
}
///
@@ -170,7 +169,6 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
if (connInfo != null)
{
GenerateDeployScriptOperation operation = new GenerateDeployScriptOperation(parameters, connInfo);
- SqlTask sqlTask = null;
TaskMetadata metadata = new TaskMetadata();
metadata.TaskOperation = operation;
metadata.TaskExecutionMode = parameters.TaskExecutionMode;
@@ -178,7 +176,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
metadata.DatabaseName = parameters.DatabaseName;
metadata.Name = SR.GenerateScriptTaskName;
- sqlTask = SqlTaskManagerInstance.CreateAndRun(metadata);
+ operation.SqlTask = SqlTaskManagerInstance.CreateAndRun(metadata);
await requestContext.SendResult(new DacFxResult()
{
@@ -201,7 +199,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
out connInfo);
if (connInfo != null)
{
- await BaseService.RunWithErrorHandling(async () =>
+ await BaseService.RunWithErrorHandling(() =>
{
GenerateDeployPlanOperation operation = new GenerateDeployPlanOperation(parameters, connInfo);
operation.Execute(parameters.TaskExecutionMode);
@@ -223,7 +221,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
///
public async Task HandleGetOptionsFromProfileRequest(GetOptionsFromProfileParams parameters, RequestContext requestContext)
{
- DeploymentOptions options = null;
+ DeploymentOptions? options = null;
if (parameters.ProfilePath != null)
{
DacProfile profile = DacProfile.Load(parameters.ProfilePath);
@@ -366,18 +364,18 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
try
{
// show file location for export and extract operations
- string targetLocation = (operation is ExportOperation || operation is ExtractOperation) ? parameters.PackageFilePath : null;
+ string? targetLocation = (operation is ExportOperation || operation is ExtractOperation) ? parameters.PackageFilePath : null;
TaskMetadata metadata = TaskMetadata.Create(parameters, taskName, operation, ConnectionServiceInstance, targetLocation);
// put appropriate database name since connection passed was to master
metadata.DatabaseName = parameters.DatabaseName;
- SqlTask sqlTask = SqlTaskManagerInstance.CreateTask(metadata);
+ operation.SqlTask = SqlTaskManagerInstance.CreateTask(metadata);
- await sqlTask.RunAsync();
+ await operation.SqlTask.RunAsync();
await requestContext.SendResult(new DacFxResult()
{
OperationId = operation.OperationId,
- Success = sqlTask.TaskStatus == SqlTaskStatus.Succeeded,
+ Success = operation.SqlTask.TaskStatus == SqlTaskStatus.Succeeded,
ErrorMessage = string.Empty
});
}
@@ -397,12 +395,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
get
{
- sqlTaskManagerInstance ??= SqlTaskManager.Instance;
- return sqlTaskManagerInstance;
- }
- set
- {
- sqlTaskManagerInstance = value;
+ return SqlTaskManager.Instance;
}
}
@@ -413,12 +406,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
get
{
- connectionService ??= ConnectionService.Instance;
- return connectionService;
- }
- set
- {
- connectionService = value;
+ return ConnectionService.Instance;
}
}
@@ -458,8 +446,8 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
try
{
- string fileVersion = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion;
- if (Version.TryParse(fileVersion, out Version version))
+ string? fileVersion = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion;
+ if (Version.TryParse(fileVersion, out Version? version))
{
return version;
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxUtils.cs
index b40a8f4c..7b028eaa 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxUtils.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DacFxUtils.cs
@@ -39,7 +39,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
List finalExcludeObjects = new List { };
var val = deployOptionsProp.GetValue(deploymentOptions);
- string[] excludeObjectTypeOptionsArray = (string[])val?.GetType()?.GetProperty("Value")?.GetValue(val);
+ string[]? excludeObjectTypeOptionsArray = (string[]?)val?.GetType()?.GetProperty("Value")?.GetValue(val);
if (excludeObjectTypeOptionsArray != null)
{
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DeployOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DeployOperation.cs
index 81e8f62b..ee071f16 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/DeployOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/DeployOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using Microsoft.SqlServer.Dac;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExportOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExportOperation.cs
index ceceb917..590044eb 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExportOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExportOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
using Microsoft.SqlTools.Utility;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExtractOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExtractOperation.cs
index 943d9d33..4006b140 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExtractOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ExtractOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using Microsoft.SqlServer.Dac;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
@@ -34,7 +33,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
public static Version ParseVersion(string incomingVersion)
{
- Version parsedVersion;
+ Version? parsedVersion;
if (!Version.TryParse(incomingVersion, out parsedVersion))
{
throw new ArgumentException(string.Format(SR.ExtractInvalidVersion, incomingVersion));
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployPlanOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployPlanOperation.cs
index 038c4a90..41d690e3 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployPlanOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployPlanOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using Microsoft.SqlServer.Dac;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
@@ -18,7 +17,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
public GenerateDeployPlanParams Parameters { get; }
- public string DeployReport { get; set; }
+ public string? DeployReport { get; set; }
public GenerateDeployPlanOperation(GenerateDeployPlanParams parameters, ConnectionInfo connInfo): base(connInfo)
{
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployScriptOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployScriptOperation.cs
index 4043dc28..51d36f13 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployScriptOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateDeployScriptOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using System.IO;
using System.Threading;
using Microsoft.SqlServer.Dac;
@@ -21,7 +20,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
{
public GenerateDeployScriptParams Parameters { get; }
- public PublishResult Result { get; set; }
+ public PublishResult? Result { get; set; }
public GenerateDeployScriptOperation(GenerateDeployScriptParams parameters, ConnectionInfo connInfo) : base(connInfo)
{
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateTSqlModelOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateTSqlModelOperation.cs
index f12ea181..fd1e34d1 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateTSqlModelOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GenerateTSqlModelOperation.cs
@@ -3,8 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
-
using System;
using System.Diagnostics;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs
index e6eaa784..828c6347 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/GetObjectsFromTSqlModelOperation.cs
@@ -3,8 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
-
using System;
using System.Linq;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ImportOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ImportOperation.cs
index 2ebb211c..c00e3ee5 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ImportOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ImportOperation.cs
@@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
using Microsoft.SqlServer.Dac;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ValidateStreamingJobOperation.cs b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ValidateStreamingJobOperation.cs
index 12fcb5cc..c624a17f 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DacFx/ValidateStreamingJobOperation.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DacFx/ValidateStreamingJobOperation.cs
@@ -3,8 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-#nullable disable
-
extern alias ASAScriptDom;
using System;