diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs index b596a194..f91e8cd3 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.cs @@ -9133,6 +9133,102 @@ namespace Microsoft.SqlTools.ServiceLayer } } + public static string MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription + { + get + { + return Keys.GetString(Keys.MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription); + } + } + + public static string TemporalTableMustHavePrimaryKeyRuleDescription + { + get + { + return Keys.GetString(Keys.TemporalTableMustHavePrimaryKeyRuleDescription); + } + } + + public static string TemporalTableMustHavePeriodColumnsRuleDescription + { + get + { + return Keys.GetString(Keys.TemporalTableMustHavePeriodColumnsRuleDescription); + } + } + + public static string PeriodColumnsRuleMoreThanOneIssueDescription + { + get + { + return Keys.GetString(Keys.PeriodColumnsRuleMoreThanOneIssueDescription); + } + } + + public static string PeriodColumnsRuleNotMatchIssueDescription + { + get + { + return Keys.GetString(Keys.PeriodColumnsRuleNotMatchIssueDescription); + } + } + + public static string ColumnsInPrimaryKeyCannotBeNullableRuleDescription + { + get + { + return Keys.GetString(Keys.ColumnsInPrimaryKeyCannotBeNullableRuleDescription); + } + } + + public static string OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription + { + get + { + return Keys.GetString(Keys.OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription); + } + } + + public static string TableMustHaveAtLeastOneColumnRuleDescription + { + get + { + return Keys.GetString(Keys.TableMustHaveAtLeastOneColumnRuleDescription); + } + } + + public static string MemoryOptimizedTableIdentityColumnRuleDescription + { + get + { + return Keys.GetString(Keys.MemoryOptimizedTableIdentityColumnRuleDescription); + } + } + + public static string TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription + { + get + { + return Keys.GetString(Keys.TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription); + } + } + + public static string MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription + { + get + { + return Keys.GetString(Keys.MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription); + } + } + + public static string MutipleCreateTableStatementsInScriptRuleDescription + { + get + { + return Keys.GetString(Keys.MutipleCreateTableStatementsInScriptRuleDescription); + } + } + public static string ConnectionServiceListDbErrorNotConnected(string uri) { return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri); @@ -9443,6 +9539,61 @@ namespace Microsoft.SqlTools.ServiceLayer return Keys.GetString(Keys.UnknownEnumString, name); } + public static string IndexMustHaveColumnsRuleDescription(string indexName) + { + return Keys.GetString(Keys.IndexMustHaveColumnsRuleDescription, indexName); + } + + public static string ForeignKeyMustHaveColumnsRuleDescription(string foreignKeyName) + { + return Keys.GetString(Keys.ForeignKeyMustHaveColumnsRuleDescription, foreignKeyName); + } + + public static string ColumnCanOnlyAppearOnceInIndexRuleDescription(string columnName, string indexName, int rowNumber) + { + return Keys.GetString(Keys.ColumnCanOnlyAppearOnceInIndexRuleDescription, columnName, indexName, rowNumber); + } + + public static string ColumnCanOnlyAppearOnceInForeignKeyRuleDescription(string columnName, string foreignKeyName, int rowNumber) + { + return Keys.GetString(Keys.ColumnCanOnlyAppearOnceInForeignKeyRuleDescription, columnName, foreignKeyName, rowNumber); + } + + public static string ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription(string columnName, string foreignKeyName, int rowNumber) + { + return Keys.GetString(Keys.ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription, columnName, foreignKeyName, rowNumber); + } + + public static string NoDuplicateConstraintNameRuleDescription(string constraintName, int rowNumber) + { + return Keys.GetString(Keys.NoDuplicateConstraintNameRuleDescription, constraintName, rowNumber); + } + + public static string NoDuplicateColumnNameRuleDescription(string columnName, int rowNumber) + { + return Keys.GetString(Keys.NoDuplicateColumnNameRuleDescription, columnName, rowNumber); + } + + public static string NoDuplicateIndexNameRuleDescription(string indexName, int rowNumber) + { + return Keys.GetString(Keys.NoDuplicateIndexNameRuleDescription, indexName, rowNumber); + } + + public static string EdgeConstraintMustHaveClausesRuleDescription(string name) + { + return Keys.GetString(Keys.EdgeConstraintMustHaveClausesRuleDescription, name); + } + + public static string EdgeConstraintNoRepeatingClausesRuleDescription(string pair, int rowNumber) + { + return Keys.GetString(Keys.EdgeConstraintNoRepeatingClausesRuleDescription, pair, rowNumber); + } + + public static string ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription(string columnName) + { + return Keys.GetString(Keys.ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription, columnName); + } + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Keys { @@ -13051,6 +13202,75 @@ namespace Microsoft.SqlTools.ServiceLayer public const string TableColumnIsComputedPersistedNullableDescription = "TableColumnIsComputedPersistedNullableDescription"; + public const string IndexMustHaveColumnsRuleDescription = "IndexMustHaveColumnsRuleDescription"; + + + public const string ForeignKeyMustHaveColumnsRuleDescription = "ForeignKeyMustHaveColumnsRuleDescription"; + + + public const string ColumnCanOnlyAppearOnceInIndexRuleDescription = "ColumnCanOnlyAppearOnceInIndexRuleDescription"; + + + public const string ColumnCanOnlyAppearOnceInForeignKeyRuleDescription = "ColumnCanOnlyAppearOnceInForeignKeyRuleDescription"; + + + public const string ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription = "ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription"; + + + public const string NoDuplicateConstraintNameRuleDescription = "NoDuplicateConstraintNameRuleDescription"; + + + public const string NoDuplicateColumnNameRuleDescription = "NoDuplicateColumnNameRuleDescription"; + + + public const string NoDuplicateIndexNameRuleDescription = "NoDuplicateIndexNameRuleDescription"; + + + public const string EdgeConstraintMustHaveClausesRuleDescription = "EdgeConstraintMustHaveClausesRuleDescription"; + + + public const string EdgeConstraintNoRepeatingClausesRuleDescription = "EdgeConstraintNoRepeatingClausesRuleDescription"; + + + public const string MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription = "MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription"; + + + public const string TemporalTableMustHavePrimaryKeyRuleDescription = "TemporalTableMustHavePrimaryKeyRuleDescription"; + + + public const string TemporalTableMustHavePeriodColumnsRuleDescription = "TemporalTableMustHavePeriodColumnsRuleDescription"; + + + public const string PeriodColumnsRuleMoreThanOneIssueDescription = "PeriodColumnsRuleMoreThanOneIssueDescription"; + + + public const string PeriodColumnsRuleNotMatchIssueDescription = "PeriodColumnsRuleNotMatchIssueDescription"; + + + public const string ColumnsInPrimaryKeyCannotBeNullableRuleDescription = "ColumnsInPrimaryKeyCannotBeNullableRuleDescription"; + + + public const string OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription = "OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription"; + + + public const string TableMustHaveAtLeastOneColumnRuleDescription = "TableMustHaveAtLeastOneColumnRuleDescription"; + + + public const string MemoryOptimizedTableIdentityColumnRuleDescription = "MemoryOptimizedTableIdentityColumnRuleDescription"; + + + public const string TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription = "TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription"; + + + public const string ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription = "ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription"; + + + public const string MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription = "MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription"; + + + public const string MutipleCreateTableStatementsInScriptRuleDescription = "MutipleCreateTableStatementsInScriptRuleDescription"; + + private Keys() { } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx index 355fe072..0a9f07ce 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.resx @@ -4983,4 +4983,107 @@ The Query Processor estimates that implementing the following index could improv Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) + + Index '{0}' does not have any columns associated with it. + . + Parameters: 0 - indexName (string) + + + Foreign key '{0}' does not have any columns specified. + . + Parameters: 0 - foreignKeyName (string) + + + Column with name '{0}' has already been added to the index '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - indexName (string), 2 - rowNumber (int) + + + Column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - foreignKeyName (string), 2 - rowNumber (int) + + + Foreign column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - foreignKeyName (string), 2 - rowNumber (int) + + + The name '{0}' is already used by another constraint. Row number: {1}. + . + Parameters: 0 - constraintName (string), 1 - rowNumber (int) + + + The name '{0}' is already used by another column. Row number: {1}. + . + Parameters: 0 - columnName (string), 1 - rowNumber (int) + + + The name '{0}' is already used by another index. Row number: {1}. + . + Parameters: 0 - indexName (string), 1 - rowNumber (int) + + + Edge constraint '{0}' does not have any clauses specified. + . + Parameters: 0 - name (string) + + + The pair '{0}' is already defined by another clause in the edge constraint. Row number: {1}. + . + Parameters: 0 - pair (string), 1 - rowNumber (int) + + + Memory-optimized table must have non-clustered primary key. + + + + System versioned table must have primary key. + + + + System versioned table must have the period columns defined. + + + + Period columns (Generated Always As Row Start/End) can only be defined once. + + + + Period columns (Generated Always As Row Start/End) must be defined as pair. If one is defined, the other must also be defined. + + + + Columns in primary key cannot be nullable. + + + + Only durable (DURABILITY = SCHEMA_AND_DATA) memory-optimized tables can be system-versioned. + + + + A table must have at least one non-computed column defined. + + + + The use of seed and increment values other than 1 is not supported with memory optimized tables. + + + + 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. + + + + Cannot use duplicate column names in primary key, column name: {0} + . + Parameters: 0 - columnName (string) + + + Memory-optimized table is not supported for this database. + + + + There are multiple table definitions in the script, only the first table can be edited in the designer. + + diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings index 247d4897..f25d24bb 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.strings @@ -2320,4 +2320,27 @@ TableColumnComputedFormulaDescription = Formula that the column uses if it is a TableColumnIsComputedPersistedTitle = Is Persisted TableColumnIsComputedPersistedDescription = Whether the computed column is saved with the data source TableColumnIsComputedPersistedNullableTitle = Is Persisted Nullable -TableColumnIsComputedPersistedNullableDescription = Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) \ No newline at end of file +TableColumnIsComputedPersistedNullableDescription = Whether the computed column can have a NULL value (NOT NULL can only be specified if the column is persisted) +IndexMustHaveColumnsRuleDescription(string indexName) = Index '{0}' does not have any columns associated with it. +ForeignKeyMustHaveColumnsRuleDescription(string foreignKeyName) = Foreign key '{0}' does not have any columns specified. +ColumnCanOnlyAppearOnceInIndexRuleDescription(string columnName, string indexName, int rowNumber) = Column with name '{0}' has already been added to the index '{1}'. Row number: {2}. +ColumnCanOnlyAppearOnceInForeignKeyRuleDescription(string columnName, string foreignKeyName, int rowNumber) = Column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. +ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription(string columnName, string foreignKeyName, int rowNumber) = Foreign column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. +NoDuplicateConstraintNameRuleDescription(string constraintName, int rowNumber) = The name '{0}' is already used by another constraint. Row number: {1}. +NoDuplicateColumnNameRuleDescription(string columnName, int rowNumber) = The name '{0}' is already used by another column. Row number: {1}. +NoDuplicateIndexNameRuleDescription(string indexName, int rowNumber) = The name '{0}' is already used by another index. Row number: {1}. +EdgeConstraintMustHaveClausesRuleDescription(string name) = Edge constraint '{0}' does not have any clauses specified. +EdgeConstraintNoRepeatingClausesRuleDescription(string pair, int rowNumber) = The pair '{0}' is already defined by another clause in the edge constraint. Row number: {1}. +MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription = Memory-optimized table must have non-clustered primary key. +TemporalTableMustHavePrimaryKeyRuleDescription = System versioned table must have primary key. +TemporalTableMustHavePeriodColumnsRuleDescription = System versioned table must have the period columns defined. +PeriodColumnsRuleMoreThanOneIssueDescription = Period columns (Generated Always As Row Start/End) can only be defined once. +PeriodColumnsRuleNotMatchIssueDescription= Period columns (Generated Always As Row Start/End) must be defined as pair. If one is defined, the other must also be defined. +ColumnsInPrimaryKeyCannotBeNullableRuleDescription = Columns in primary key cannot be nullable. +OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription = Only durable (DURABILITY = SCHEMA_AND_DATA) memory-optimized tables can be system-versioned. +TableMustHaveAtLeastOneColumnRuleDescription = A table must have at least one non-computed column defined. +MemoryOptimizedTableIdentityColumnRuleDescription = The use of seed and increment values other than 1 is not supported with memory optimized tables. +TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription = 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. +ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription(string columnName) = Cannot use duplicate column names in primary key, column name: {0} +MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription = Memory-optimized table is not supported for this database. +MutipleCreateTableStatementsInScriptRuleDescription = There are multiple table definitions in the script, only the first table can be edited in the designer. \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf index cd6a3743..059f46ea 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf +++ b/src/Microsoft.SqlTools.ServiceLayer/Localization/sr.xlf @@ -6068,6 +6068,132 @@ The Query Processor estimates that implementing the following index could improv Formula + + Index '{0}' does not have any columns associated with it. + Index '{0}' does not have any columns associated with it. + . + Parameters: 0 - indexName (string) + + + Foreign key '{0}' does not have any columns specified. + Foreign key '{0}' does not have any columns specified. + . + Parameters: 0 - foreignKeyName (string) + + + Column with name '{0}' has already been added to the index '{1}'. Row number: {2}. + Column with name '{0}' has already been added to the index '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - indexName (string), 2 - rowNumber (int) + + + Column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + Column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - foreignKeyName (string), 2 - rowNumber (int) + + + Foreign column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + Foreign column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}. + . + Parameters: 0 - columnName (string), 1 - foreignKeyName (string), 2 - rowNumber (int) + + + The name '{0}' is already used by another constraint. Row number: {1}. + The name '{0}' is already used by another constraint. Row number: {1}. + . + Parameters: 0 - constraintName (string), 1 - rowNumber (int) + + + The name '{0}' is already used by another column. Row number: {1}. + The name '{0}' is already used by another column. Row number: {1}. + . + Parameters: 0 - columnName (string), 1 - rowNumber (int) + + + The name '{0}' is already used by another index. Row number: {1}. + The name '{0}' is already used by another index. Row number: {1}. + . + Parameters: 0 - indexName (string), 1 - rowNumber (int) + + + Edge constraint '{0}' does not have any clauses specified. + Edge constraint '{0}' does not have any clauses specified. + . + Parameters: 0 - name (string) + + + The pair '{0}' is already defined by another clause in the edge constraint. Row number: {1}. + The pair '{0}' is already defined by another clause in the edge constraint. Row number: {1}. + . + Parameters: 0 - pair (string), 1 - rowNumber (int) + + + Memory-optimized table must have non-clustered primary key. + Memory-optimized table must have non-clustered primary key. + + + + System versioned table must have primary key. + System versioned table must have primary key. + + + + System versioned table must have the period columns defined. + System versioned table must have the period columns defined. + + + + Period columns (Generated Always As Row Start/End) can only be defined once. + Period columns (Generated Always As Row Start/End) can only be defined once. + + + + Period columns (Generated Always As Row Start/End) must be defined as pair. If one is defined, the other must also be defined. + Period columns (Generated Always As Row Start/End) must be defined as pair. If one is defined, the other must also be defined. + + + + Columns in primary key cannot be nullable. + Columns in primary key cannot be nullable. + + + + Only durable (DURABILITY = SCHEMA_AND_DATA) memory-optimized tables can be system-versioned. + Only durable (DURABILITY = SCHEMA_AND_DATA) memory-optimized tables can be system-versioned. + + + + A table must have at least one non-computed column defined. + A table must have at least one non-computed column defined. + + + + The use of seed and increment values other than 1 is not supported with memory optimized tables. + The use of seed and increment values other than 1 is not supported with memory optimized tables. + + + + 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. + 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. + + + + Cannot use duplicate column names in primary key, column name: {0} + Cannot use duplicate column names in primary key, column name: {0} + . + Parameters: 0 - columnName (string) + + + Memory-optimized table is not supported for this database. + Memory-optimized table is not supported for this database. + + + + There are multiple table definitions in the script, only the first table can be edited in the designer. + There are multiple table definitions in the script, only the first table can be edited in the designer. + + \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerValidator.cs b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerValidator.cs index 5e221724..5bc5cead 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerValidator.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerValidator.cs @@ -24,7 +24,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner new EdgeConstraintNoRepeatingClausesRule(), new MemoryOptimizedCannotBeEnabledWhenNotSupportedRule(), new MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRule(), - new TemporalTableMustHavePeriodColumns(), + new TemporalTableMustHavePeriodColumnsRule(), new PeriodColumnsRule(), new ColumnsInPrimaryKeyCannotBeNullableRule(), new OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRule(), @@ -68,7 +68,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Index '{0}' does not have any columns associated with it.", index.Name), + Description = SR.IndexMustHaveColumnsRuleDescription(index.Name), PropertyPath = new object[] { TablePropertyNames.Indexes, i } }); } @@ -90,7 +90,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Foreign key '{0}' does not have any columns specified.", foreignKey.Name), + Description = SR.ForeignKeyMustHaveColumnsRuleDescription(foreignKey.Name), PropertyPath = new object[] { TablePropertyNames.ForeignKeys, i } }); } @@ -116,7 +116,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Column with name '{0}' has already been added to the index '{1}'. Row number: {2}.", columnSpec.Column, index.Name, j + 1), + Description = SR.ColumnCanOnlyAppearOnceInIndexRuleDescription(columnSpec.Column, index.Name, j + 1), PropertyPath = new object[] { TablePropertyNames.Indexes, i, IndexPropertyNames.Columns, j } }); } @@ -147,7 +147,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}.", column, foreignKey.Name, j + 1), + Description = SR.ColumnCanOnlyAppearOnceInForeignKeyRuleDescription(column, foreignKey.Name, j + 1), PropertyPath = new object[] { TablePropertyNames.ForeignKeys, i, ForeignKeyPropertyNames.ColumnMapping, j, ForeignKeyColumnMappingPropertyNames.Column } }); } @@ -165,7 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Foreign column with name '{0}' has already been added to the foreign key '{1}'. Row number: {2}.", foreignColumn, foreignKey.Name, j + 1), + Description = SR.ColumnCanOnlyAppearOnceInForeignKeyRuleForeignColumnDescription(foreignColumn, foreignKey.Name, j + 1), PropertyPath = new object[] { TablePropertyNames.ForeignKeys, i, ForeignKeyPropertyNames.ColumnMapping, j, ForeignKeyColumnMappingPropertyNames.ForeignColumn } }); } @@ -193,7 +193,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The name '{0}' is already used by another constraint. Row number: {1}.", foreignKey.Name, i + 1), + Description = SR.NoDuplicateConstraintNameRuleDescription(foreignKey.Name, i + 1), PropertyPath = new object[] { TablePropertyNames.ForeignKeys, i, ForeignKeyPropertyNames.Name } }); } @@ -211,7 +211,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The name '{0}' is already used by another constraint. Row number: {1}.", checkConstraint.Name, i + 1), + Description = SR.NoDuplicateConstraintNameRuleDescription(checkConstraint.Name, i + 1), PropertyPath = new object[] { TablePropertyNames.CheckConstraints, i, CheckConstraintPropertyNames.Name } }); } @@ -228,7 +228,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The name '{0}' is already used by another constraint. Row number: {1}.", edgeConstraint.Name, i + 1), + Description = SR.NoDuplicateConstraintNameRuleDescription(edgeConstraint.Name, i + 1), PropertyPath = new object[] { TablePropertyNames.EdgeConstraints, i, EdgeConstraintPropertyNames.Name } }); } @@ -255,7 +255,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The name '{0}' is already used by another column. Row number: {1}.", column.Name, i + 1), + Description = SR.NoDuplicateColumnNameRuleDescription(column.Name, i + 1), PropertyPath = new object[] { TablePropertyNames.Columns, i, TableColumnPropertyNames.Name } }); } @@ -282,7 +282,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The name '{0}' is already used by another index. Row number: {1}.", index.Name, i + 1), + Description = SR.NoDuplicateIndexNameRuleDescription(index.Name, i + 1), PropertyPath = new object[] { TablePropertyNames.Indexes, i, IndexPropertyNames.Name } }); } @@ -308,7 +308,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Edge constraint '{0}' does not have any clauses specified.", edgeConstraint.Name), + Description = SR.EdgeConstraintMustHaveClausesRuleDescription(edgeConstraint.Name), PropertyPath = new object[] { TablePropertyNames.EdgeConstraints, i } }); } @@ -335,7 +335,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("The pair '{0}' is already defined by another clause in the edge constraint. Row number: {1}.", pair, j + 1), + Description = SR.EdgeConstraintNoRepeatingClausesRuleDescription(pair, j + 1), PropertyPath = new object[] { TablePropertyNames.EdgeConstraints, i, EdgeConstraintPropertyNames.Clauses, j, EdgeConstraintClausePropertyNames.FromTable } }); } @@ -359,7 +359,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "Memory-optimized table must have non-clustered primary key.", + Description = SR.MemoryOptimizedTableMustHaveNonClusteredPrimaryKeyRuleDescription, PropertyPath = new object[] { TablePropertyNames.PrimaryKeyIsClustered } }); } @@ -377,14 +377,14 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "System versioned table must have primary key." + Description = SR.TemporalTableMustHavePrimaryKeyRuleDescription }); } return errors; } } - public class TemporalTableMustHavePeriodColumns : ITableDesignerValidationRule + public class TemporalTableMustHavePeriodColumnsRule : ITableDesignerValidationRule { public List Run(Dac.TableDesigner designer) { @@ -394,7 +394,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "System versioned table must have the period columns defined.", + Description = SR.TemporalTableMustHavePeriodColumnsRuleDescription, MoreInfoLink = "https://docs.microsoft.com/sql/relational-databases/tables/creating-a-system-versioned-temporal-table" }); } @@ -414,14 +414,14 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "Period columns (Generated Always As Row Start/End) can only be defined once." + Description = SR.PeriodColumnsRuleMoreThanOneIssueDescription }); } else if (rowEnd.Count() != rowStart.Count()) { errors.Add(new TableDesignerIssue() { - Description = "Period columns (Generated Always As Row Start/End) must be defined as pair. If one is defined, the other must also be defined" + Description = SR.PeriodColumnsRuleNotMatchIssueDescription }); } return errors; @@ -441,7 +441,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "Columns in primary key cannot be nullable.", + Description = SR.ColumnsInPrimaryKeyCannotBeNullableRuleDescription, PropertyPath = new object[] { TablePropertyNames.Columns, i } }); } @@ -460,7 +460,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "Only durable (DURABILITY = SCHEMA_AND_DATA) memory-optimized tables can be system-versioned." + Description = SR.OnlyDurableMemoryOptimizedTableCanBeSystemVersionedRuleDescription }); } return errors; @@ -477,7 +477,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = "A table must have at least one non-computed column defined." + Description = SR.TableMustHaveAtLeastOneColumnRuleDescription }); } return errors; @@ -500,7 +500,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner var propertyName = column.IdentitySeed != 1 ? TableColumnPropertyNames.IdentitySeed : TableColumnPropertyNames.IdentityIncrement; errors.Add(new TableDesignerIssue() { - Description = "The use of seed and increment values other than 1 is not supported with memory optimized tables.", + Description = SR.MemoryOptimizedTableIdentityColumnRuleDescription, PropertyPath = new object[] { TablePropertyNames.Columns, i, propertyName } }); } @@ -520,7 +520,7 @@ 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.", + Description = SR.TableShouldAvoidHavingMultipleEdgeConstraintsRuleDescription, Severity = Contracts.IssueSeverity.Warning, MoreInfoLink = "https://docs.microsoft.com/sql/relational-databases/tables/graph-edge-constraints" }); @@ -545,7 +545,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Cannot use duplicate column names in primary key, column name: {0}", columnSpec.Column), + Description = SR.ColumnCannotBeListedMoreThanOnceInPrimaryKeyRuleDescription(columnSpec.Column), PropertyPath = new object[] { TablePropertyNames.PrimaryKeyColumns, i, IndexColumnSpecificationPropertyNames.Column } }); } @@ -569,7 +569,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner { errors.Add(new TableDesignerIssue() { - Description = string.Format("Memory-optimized table is not supported for this database."), + Description = SR.MemoryOptimizedCannotBeEnabledWhenNotSupportedRuleDescription, PropertyPath = new object[] { TablePropertyNames.IsMemoryOptimized }, MoreInfoLink = designer.IsAzure ? "https://docs.microsoft.com/en-us/azure/azure-sql/in-memory-oltp-overview" @@ -585,10 +585,11 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner public List Run(Dac.TableDesigner designer) { var errors = new List(); - if(designer.ScriptContainsMultipleTableDefinition) + if (designer.ScriptContainsMultipleTableDefinition) { - errors.Add(new TableDesignerIssue(){ - Description = "There are multiple table definitions in the script, only the first table can be edited in the designer.", + errors.Add(new TableDesignerIssue() + { + Description = SR.MutipleCreateTableStatementsInScriptRuleDescription, Severity = Contracts.IssueSeverity.Information }); }