Skip to content

Commit 6858e96

Browse files
authored
Adding SqlPackage Service for supporting Sqlpackage command generation changes (#2556)
* Inital changes: sqlpakcage service with nuget import * fixing build errors * adding hint path to use the hybrid package and updated sqlpakcage service * new updates * adding test with generic command generation * latest updates with serialized params * still have different API method calls * making the API to generic * final changes * refactoring by reusing targetFx variable * keeping the sqlpackage command line result separate * removing hintpatha nd using core nuget * fixing build and tests with sqlpackage .core Nuget * using new nuget version * adding command line args DTO * fixing the issues * using Builder with latest nuget and updated tests * refactoring and cpturing the sqlpackage exception * adding XML comments for the methods * adding masked option to the command request * updating sqlpackage core nuget version * Temporarily adding the Nuget for PR validations, will remove once the nuget publicly available * Refactoring itno simple classes * test fixes * removing local nuget, the core nuget is published to nuget org * removing the duplicated commandlineArgs and inheriting from the dacfx cmdArgs * adding loc string and removed undo batchparser change * vbump core nuget with the latest iteration
1 parent 75c3281 commit 6858e96

File tree

21 files changed

+636
-10
lines changed

21 files changed

+636
-10
lines changed

Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<PackageReference Update="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.1.1" />
2323
<PackageReference Update="Microsoft.SqlServer.Management.SmoMetadataProvider" Version="170.18.0" />
2424
<PackageReference Update="Microsoft.SqlServer.DacFx" Version="170.2.70" />
25+
<PackageReference Update="Microsoft.SqlPackage.Core" Version="0.1.75-preview" />
2526
<PackageReference Update="Microsoft.SqlServer.DacFx.Projects" Version="0.5.2-preview" />
2627
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="14.0.3" />
2728
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="9.0.4" />
@@ -89,4 +90,4 @@
8990
<ItemGroup>
9091
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
9192
</ItemGroup>
92-
</Project>
93+
</Project>

src/Microsoft.Kusto.ServiceLayer/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

src/Microsoft.SqlTools.Credentials/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

src/Microsoft.SqlTools.Hosting/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

src/Microsoft.SqlTools.ManagedBatchParser/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

src/Microsoft.SqlTools.ResourceProvider.Core/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

src/Microsoft.SqlTools.ResourceProvider.DefaultImpl/Localization/sr.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,22 @@ public static DeploymentOptions GetDefaultPublishOptions()
283283

284284
return result;
285285
}
286+
287+
/// <summary>
288+
/// Normalizes the 7 overridden options for Publish/Script SqlPackage command generation.
289+
/// Resets them to DacFx native defaults so they won't appear as unnecessary /p: parameters.
290+
/// Works because: if user changed a value, they changed it to the opposite (which is the DacFx default).
291+
/// </summary>
292+
public void NormalizePublishDefaults()
293+
{
294+
// Simply set the 7 STS-overridden options to DacFx defaults
295+
BooleanOptionsDictionary[nameof(DacDeployOptions.AllowDropBlockingAssemblies)].Value = false;
296+
BooleanOptionsDictionary[nameof(DacDeployOptions.AllowIncompatiblePlatform)].Value = false;
297+
BooleanOptionsDictionary[nameof(DacDeployOptions.DropObjectsNotInSource)].Value = false;
298+
BooleanOptionsDictionary[nameof(DacDeployOptions.DropPermissionsNotInSource)].Value = false;
299+
BooleanOptionsDictionary[nameof(DacDeployOptions.DropRoleMembersNotInSource)].Value = false;
300+
BooleanOptionsDictionary[nameof(DacDeployOptions.IgnoreKeywordCasing)].Value = true;
301+
BooleanOptionsDictionary[nameof(DacDeployOptions.IgnoreSemicolonBetweenStatements)].Value = true;
302+
}
286303
}
287304
}

src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Microsoft.SqlTools.ServiceLayer.Connection;
2121
using Microsoft.SqlTools.ServiceLayer.Copilot;
2222
using Microsoft.SqlTools.ServiceLayer.DacFx;
23+
using Microsoft.SqlTools.ServiceLayer.SqlPackage;
2324
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;
2425
using Microsoft.SqlTools.ServiceLayer.EditData;
2526
using Microsoft.SqlTools.ServiceLayer.ExecutionPlan;
@@ -136,6 +137,9 @@ private static void InitializeRequestHandlersAndServices(ServiceHost serviceHost
136137
DacFxService.Instance.InitializeService(serviceHost, commandOptions);
137138
serviceProvider.RegisterSingleService(DacFxService.Instance);
138139

140+
SqlPackageService.Instance.InitializeService(serviceHost);
141+
serviceProvider.RegisterSingleService(SqlPackageService.Instance);
142+
139143
CmsService.Instance.InitializeService(serviceHost);
140144
serviceProvider.RegisterSingleService(CmsService.Instance);
141145

src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// WARNING:
2-
// This file was generated by the Microsoft SQL Server String Resource Tool 9.0.0.0
2+
// This file was generated by the Microsoft SQL Server String Resource Tool 10.0.0.0
33
// from information in sr.strings
44
// DO NOT MODIFY THIS FILE'S CONTENTS, THEY WILL BE OVERWRITTEN
55
//
@@ -1623,6 +1623,14 @@ public static string SqlBindingsNet5NotSupported
16231623
}
16241624
}
16251625

1626+
public static string SqlPackageInvalidRequestParameters
1627+
{
1628+
get
1629+
{
1630+
return Keys.GetString(Keys.SqlPackageInvalidRequestParameters);
1631+
}
1632+
}
1633+
16261634
public static string Statement
16271635
{
16281636
get
@@ -11740,6 +11748,9 @@ public class Keys
1174011748
public const string SqlBindingsNet5NotSupported = "SqlBindingsNet5NotSupported";
1174111749

1174211750

11751+
public const string SqlPackageInvalidRequestParameters = "SqlPackageInvalidRequestParameters";
11752+
11753+
1174311754
public const string Statement = "Statement";
1174411755

1174511756

0 commit comments

Comments
 (0)