mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
fix memory optimized option inconsistent state (#1503)
* disable mem optimized instead of removing options * bump DacFx
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<PackageReference Update="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.1.1" />
|
||||
<PackageReference Update="Microsoft.Data.SqlClient" Version="3.1.0"/>
|
||||
<PackageReference Update="Microsoft.SqlServer.SqlManagementObjects" Version="161.46367.54" />
|
||||
<PackageReference Update="Microsoft.SqlServer.DACFx" Version="160.6143.0-preview" GeneratePathProperty="true" />
|
||||
<PackageReference Update="Microsoft.SqlServer.DACFx" Version="160.6164.0-preview" GeneratePathProperty="true" />
|
||||
<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.0.305]" />
|
||||
|
||||
@@ -767,7 +767,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
|
||||
// Memory-optimized related properties
|
||||
tableViewModel.IsMemoryOptimized.Checked = table.IsMemoryOptimized;
|
||||
tableViewModel.IsMemoryOptimized.Enabled = table.CanEditIsMemoryOptimized;
|
||||
tableViewModel.IsMemoryOptimized.Enabled = table.CanEditIsMemoryOptimized || (table.IsMemoryOptimized && !tableDesigner.IsMemoryOptimizedTableSupported);
|
||||
tableViewModel.Durability.Enabled = table.CanEditDurability;
|
||||
tableViewModel.Durability.Value = SqlTableDurabilityUtil.Instance.GetName(table.Durability);
|
||||
tableViewModel.Durability.Values = SqlTableDurabilityUtil.Instance.DisplayNames;
|
||||
@@ -1358,10 +1358,6 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
|
||||
private void SetMemoryOptimizedTableViewInfo(TableDesignerView view, Dac.TableDesigner tableDesigner)
|
||||
{
|
||||
if (!tableDesigner.IsMemoryOptimizedTableSupported)
|
||||
{
|
||||
return;
|
||||
}
|
||||
view.AdditionalTableProperties.Add(new DesignerDataPropertyInfo()
|
||||
{
|
||||
PropertyName = TablePropertyNames.IsMemoryOptimized,
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
new NoDuplicateIndexNameRule(),
|
||||
new EdgeConstraintMustHaveClausesRule(),
|
||||
new EdgeConstraintNoRepeatingClausesRule(),
|
||||
new MemoryOptimizedCannotBeEnabledWhenNotSupportedRule(),
|
||||
new MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRule(),
|
||||
new TemporalTableMustHavePeriodColumns(),
|
||||
new PeriodColumnsRule(),
|
||||
@@ -518,8 +519,9 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
{
|
||||
errors.Add(new TableDesignerIssue()
|
||||
{
|
||||
Description = "The table has more than one edge constraint on it. This is only useful as a temporary state when modifying existing edge constraints, and should not be used in other cases. Please refer to https://docs.microsoft.com/sql/relational-databases/tables/graph-edge-constraints for more details.",
|
||||
Severity = Contracts.IssueSeverity.Warning
|
||||
Description = "The table has more than one edge constraint on it. This is only useful as a temporary state when modifying existing edge constraints, and should not be used in other cases.",
|
||||
Severity = Contracts.IssueSeverity.Warning,
|
||||
MoreInfoLink = "https://docs.microsoft.com/sql/relational-databases/tables/graph-edge-constraints"
|
||||
});
|
||||
}
|
||||
return errors;
|
||||
@@ -555,4 +557,25 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
public class MemoryOptimizedCannotBeEnabledWhenNotSupportedRule : ITableDesignerValidationRule
|
||||
{
|
||||
public List<TableDesignerIssue> Run(Dac.TableDesigner designer)
|
||||
{
|
||||
var table = designer.TableViewModel;
|
||||
var errors = new List<TableDesignerIssue>();
|
||||
if (!designer.IsMemoryOptimizedTableSupported && designer.TableViewModel.IsMemoryOptimized)
|
||||
{
|
||||
errors.Add(new TableDesignerIssue()
|
||||
{
|
||||
Description = string.Format("Memory-optimized table is not supported for this database."),
|
||||
PropertyPath = new object[] { TablePropertyNames.IsMemoryOptimized },
|
||||
MoreInfoLink = designer.IsAzure
|
||||
? "https://docs.microsoft.com/en-us/azure/azure-sql/in-memory-oltp-overview"
|
||||
: "https://docs.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/overview-and-usage-scenarios"
|
||||
});
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user