mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-05 01:25:45 -05:00
Revert "Revert "Adding new Dac Deployment Options and getting descriptions fr…" (#1507)
* Adding missing Deploy options
* SQL DB Project database genScript/Publish working but tests
* Test cases fixed for the changes for DacFx and SC services
* Refactored the model name and tested the changes with ADS extensions.
* updated DeploymentOptionProperty model and corresponding updates.
* Adding DisplayNames to the deploymentOptionProperty to maintain names in STS for all extensions.
* MapTabe intialization in constructor
* Updated comment with more meaning
* Porperty strong type update with actual type
* Creating model with generic type getting using Activator.CreateInstance
* Rebase to main and resolved merge conflicts
* Xml comments added and code updated
* Deployment options update
* Deployoptions typo and comments updates a
* updated deployment options comments
* removed unnecessary using statement
* code refactor
* Revert "Revert "Adding new Dac Deployment Options and getting descriptions from DacFx API (#1357)" (#1493)"
This reverts commit 2b48331115.
* removing duplicated default empty string value
This commit is contained in:
committed by
GitHub
parent
262fd00afd
commit
62d3cdc99a
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.SqlServer.Dac;
|
||||
using Microsoft.SqlServer.Dac.Compare;
|
||||
@@ -24,7 +25,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
{
|
||||
internal static DacDeployOptions CreateSchemaCompareOptions(DeploymentOptions deploymentOptions)
|
||||
{
|
||||
System.Reflection.PropertyInfo[] deploymentOptionsProperties = deploymentOptions.GetType().GetProperties();
|
||||
PropertyInfo[] deploymentOptionsProperties = deploymentOptions.GetType().GetProperties();
|
||||
|
||||
DacDeployOptions dacOptions = new DacDeployOptions();
|
||||
foreach (var deployOptionsProp in deploymentOptionsProperties)
|
||||
@@ -32,7 +33,18 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
var prop = dacOptions.GetType().GetProperty(deployOptionsProp.Name);
|
||||
if (prop != null)
|
||||
{
|
||||
prop.SetValue(dacOptions, deployOptionsProp.GetValue(deploymentOptions));
|
||||
var val = deployOptionsProp.GetValue(deploymentOptions);
|
||||
var selectedVal = val.GetType().GetProperty("Value").GetValue(val);
|
||||
|
||||
// JSON.NET by default reads Number type as Int64, deserializing an object type to dacOptions of Int32 type required to convert into Int32 from Int64.
|
||||
// If not converted setting value(Int64) to dacOption(Int32) will throw {"Object of type 'System.Int64' cannot be converted to type 'System.Int32'."}.
|
||||
// As these integer type options are non-editable and are not availbale in ADS to update, integer overflow exception will not be happening here.
|
||||
if (selectedVal != null && selectedVal.GetType() == typeof(System.Int64))
|
||||
{
|
||||
selectedVal = Convert.ToInt32(selectedVal);
|
||||
}
|
||||
|
||||
prop.SetValue(dacOptions, selectedVal);
|
||||
}
|
||||
}
|
||||
return dacOptions;
|
||||
|
||||
Reference in New Issue
Block a user