Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating SQL Projects nuget dependency #2253

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageReference Update="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.1.1" />
<PackageReference Update="Microsoft.SqlServer.Management.SmoMetadataProvider" Version="170.18.0" />
<PackageReference Update="Microsoft.SqlServer.DacFx" Version="162.1.153-preview" />
<PackageReference Update="Microsoft.SqlServer.DacFx.Projects" Version="0.1.14-preview" />
<PackageReference Update="Microsoft.SqlServer.DacFx.Projects" Version="0.2.2-preview" />
<PackageReference Update="Microsoft.Azure.Kusto.Data" Version="9.0.4" />
<PackageReference Update="Microsoft.Azure.Kusto.Language" Version="9.0.4" />
<PackageReference Update="Microsoft.SqlServer.Assessment" Version="[1.1.17]" />
Expand Down
8 changes: 8 additions & 0 deletions src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11388,6 +11388,11 @@ public static string PropertyNotInitialized(string propertyName)
return Keys.GetString(Keys.PropertyNotInitialized, propertyName);
}

public static string InvalidDspFormatError(string dsp)
{
return Keys.GetString(Keys.InvalidDspFormatError, dsp);
}

[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Keys
{
Expand Down Expand Up @@ -15758,6 +15763,9 @@ public class Keys
public const string PropertyNotInitialized = "PropertyNotInitialized";


public const string InvalidDspFormatError = "InvalidDspFormatError";


private Keys()
{ }

Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -6028,4 +6028,9 @@ The Query Processor estimates that implementing the following index could improv
<comment>.
Parameters: 0 - propertyName (string) </comment>
</data>
<data name="InvalidDspFormatError" xml:space="preserve">
<value>Invalid value for Database Schema Provider: &apos;{0}&apos;; expected to be in the form &apos;Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider&apos;.</value>
<comment>.
Parameters: 0 - dsp (string) </comment>
</data>
</root>
8 changes: 6 additions & 2 deletions src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2426,5 +2426,9 @@ HyperscaleAzureEdition = Hyperscale
#############################################################################
# Server Properties

############################################################################
PropertyNotInitialized(string propertyName) = Property '{0}' was set before initialization.
PropertyNotInitialized(string propertyName) = Property '{0}' was set before initialization.

#############################################################################
# SqlProjects

InvalidDspFormatError(string dsp) = Invalid value for Database Schema Provider: '{0}'; expected to be in the form 'Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider'.
6 changes: 6 additions & 0 deletions src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -7364,6 +7364,12 @@ The Query Processor estimates that implementing the following index could improv
<target state="new">7 Days</target>
<note></note>
</trans-unit>
<trans-unit id="InvalidDspFormatError">
<source>Invalid value for Database Schema Provider: '{0}'; expected to be in the form 'Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider'.</source>
<target state="new">Invalid value for Database Schema Provider: '{0}'; expected to be in the form 'Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider'.</target>
<note>.
Parameters: 0 - dsp (string) </note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ internal async Task HandleCreateSqlProjectRequest(Contracts.CreateSqlProjectPara
{
await RunWithErrorHandling(async () =>
{
await SqlProject.CreateProjectAsync(requestParams.ProjectUri, new SqlServer.Dac.Projects.CreateSqlProjectParams() { ProjectType = requestParams.SqlProjectType, DspVersion = requestParams.DatabaseSchemaProvider });
SqlServer.Dac.Projects.CreateSqlProjectParams createParams = new()
{
ProjectType = requestParams.SqlProjectType,
TargetPlatform = requestParams.DatabaseSchemaProvider == null ? null : Utilities.DatabaseSchemaProviderToSqlPlatform(requestParams.DatabaseSchemaProvider),
BuildSdkVersion = requestParams.BuildSdkVersion
Benjin marked this conversation as resolved.
Show resolved Hide resolved
};

await SqlProject.CreateProjectAsync(requestParams.ProjectUri, createParams);
this.GetProject(requestParams.ProjectUri); // load into the cache
}, requestContext);
}
Expand Down Expand Up @@ -169,7 +176,7 @@ internal async Task HandleSetDatabaseSourceRequest(SetDatabaseSourceParams reque

internal async Task HandleSetDatabaseSchemaProviderRequest(SetDatabaseSchemaProviderParams requestParams, RequestContext<ResultStatus> requestContext)
{
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri, onlyLoadProperties: true).Properties.DatabaseSchemaProvider = requestParams.DatabaseSchemaProvider, requestContext);
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri, onlyLoadProperties: true).Properties.TargetSqlPlatform = Utilities.DatabaseSchemaProviderToSqlPlatform(requestParams.DatabaseSchemaProvider), requestContext);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Data.Tools.Schema.SchemaModel;
using Microsoft.SqlServer.Dac.Projects;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
using Microsoft.SqlTools.ServiceLayer.SqlProjects;
Expand Down Expand Up @@ -62,13 +63,17 @@ public async Task TestOpenCloseProject()
await service.HandleCreateSqlProjectRequest(new ServiceLayer.SqlProjects.Contracts.CreateSqlProjectParams()
{
ProjectUri = sdkProjectUri,
SqlProjectType = ProjectType.SdkStyle
SqlProjectType = ProjectType.SdkStyle,
DatabaseSchemaProvider = "Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider", // non-default DSP
BuildSdkVersion = "0.1.7-preview" // non-default (old) SDK version
}, requestMock.Object);

requestMock.AssertSuccess(nameof(service.HandleCreateSqlProjectRequest), "SDK");
Assert.AreEqual(1, service.Projects.Count, "Number of loaded projects after creating SDK not as expected");
Assert.IsTrue(service.Projects.ContainsKey(sdkProjectUri), "Loaded project list expected to contain SDK project URI");
Assert.AreEqual(ProjectType.SdkStyle, service.Projects[sdkProjectUri].SqlProjStyle, "SqlProj style expected to be SDK");
Assert.AreEqual(SqlPlatforms.SqlAzureV12, service.Projects[sdkProjectUri].Properties.TargetSqlPlatform, "Target SQL platform expected to be Azure");
Assert.AreEqual("0.1.7-preview", service.Projects[sdkProjectUri].MicrosoftBuildSqlSdkVersion, "SQL SDK version expected to be 0.1.7-preview");

// Validate creating Legacy-style project
requestMock = new();
Expand Down
Loading