fix memory optimized option inconsistent state (#1503)

* disable mem optimized instead of removing options

* bump DacFx
This commit is contained in:
Hai Cao
2022-05-23 13:27:18 -07:00
committed by GitHub
parent 795e76fdf5
commit 262fd00afd
3 changed files with 27 additions and 8 deletions

View File

@@ -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;
}
}
}