table designer - support indexes and write operations (#1363)

* support indexes

* column properties
This commit is contained in:
Alan Ren
2022-01-18 17:15:22 -08:00
committed by GitHub
parent 01ab08fd6d
commit 1cdb2b94ac
9 changed files with 646 additions and 80 deletions

View File

@@ -8581,6 +8581,70 @@ namespace Microsoft.SqlTools.ServiceLayer
}
}
public static string IndexIsEnabledPropertyDescription
{
get
{
return Keys.GetString(Keys.IndexIsEnabledPropertyDescription);
}
}
public static string IndexIsClusteredPropertyDescription
{
get
{
return Keys.GetString(Keys.IndexIsClusteredPropertyDescription);
}
}
public static string TableDesignerIndexIsClusteredPropertyTitle
{
get
{
return Keys.GetString(Keys.TableDesignerIndexIsClusteredPropertyTitle);
}
}
public static string IndexIsUniquePropertyDescription
{
get
{
return Keys.GetString(Keys.IndexIsUniquePropertyDescription);
}
}
public static string TableDesignerIsUniquePropertyTitle
{
get
{
return Keys.GetString(Keys.TableDesignerIsUniquePropertyTitle);
}
}
public static string IndexColumnIsAscendingPropertyDescription
{
get
{
return Keys.GetString(Keys.IndexColumnIsAscendingPropertyDescription);
}
}
public static string IndexColumnIsAscendingPropertyTitle
{
get
{
return Keys.GetString(Keys.IndexColumnIsAscendingPropertyTitle);
}
}
public static string TableDesignerColumnsDisplayValueTitle
{
get
{
return Keys.GetString(Keys.TableDesignerColumnsDisplayValueTitle);
}
}
public static string ConnectionServiceListDbErrorNotConnected(string uri)
{
return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri);
@@ -12268,6 +12332,30 @@ namespace Microsoft.SqlTools.ServiceLayer
public const string CheckConstraintIsEnabledDescription = "CheckConstraintIsEnabledDescription";
public const string IndexIsEnabledPropertyDescription = "IndexIsEnabledPropertyDescription";
public const string IndexIsClusteredPropertyDescription = "IndexIsClusteredPropertyDescription";
public const string TableDesignerIndexIsClusteredPropertyTitle = "TableDesignerIndexIsClusteredPropertyTitle";
public const string IndexIsUniquePropertyDescription = "IndexIsUniquePropertyDescription";
public const string TableDesignerIsUniquePropertyTitle = "TableDesignerIsUniquePropertyTitle";
public const string IndexColumnIsAscendingPropertyDescription = "IndexColumnIsAscendingPropertyDescription";
public const string IndexColumnIsAscendingPropertyTitle = "IndexColumnIsAscendingPropertyTitle";
public const string TableDesignerColumnsDisplayValueTitle = "TableDesignerColumnsDisplayValueTitle";
private Keys()
{ }

View File

@@ -4689,4 +4689,36 @@
<value>Specifies whether the check constraint is Enabled</value>
<comment></comment>
</data>
<data name="IndexIsEnabledPropertyDescription" xml:space="preserve">
<value>Specifies whether the index is enabled</value>
<comment></comment>
</data>
<data name="IndexIsClusteredPropertyDescription" xml:space="preserve">
<value>Whether the index is clustered, only one clustered index is allowed in a table.</value>
<comment></comment>
</data>
<data name="TableDesignerIndexIsClusteredPropertyTitle" xml:space="preserve">
<value>Is Clustered</value>
<comment></comment>
</data>
<data name="IndexIsUniquePropertyDescription" xml:space="preserve">
<value>Whether the data entered into this index must be unique.</value>
<comment></comment>
</data>
<data name="TableDesignerIsUniquePropertyTitle" xml:space="preserve">
<value>Is Unique</value>
<comment></comment>
</data>
<data name="IndexColumnIsAscendingPropertyDescription" xml:space="preserve">
<value>Specifies the sort order of the column.</value>
<comment></comment>
</data>
<data name="IndexColumnIsAscendingPropertyTitle" xml:space="preserve">
<value>Is Ascending</value>
<comment></comment>
</data>
<data name="TableDesignerColumnsDisplayValueTitle" xml:space="preserve">
<value>Columns</value>
<comment></comment>
</data>
</root>

View File

@@ -2243,3 +2243,11 @@ SqlForeignKeyAction_SetNull = Set Null
SqlForeignKeyAction_SetDefault = Set Default
UnKnownSqlForeignKeyAction(string name) = '{0}' is not a supported SqlForeignKeyAction.
CheckConstraintIsEnabledDescription = Specifies whether the check constraint is Enabled
IndexIsEnabledPropertyDescription = Specifies whether the index is enabled
IndexIsClusteredPropertyDescription = Whether the index is clustered, only one clustered index is allowed in a table.
TableDesignerIndexIsClusteredPropertyTitle = Is Clustered
IndexIsUniquePropertyDescription = Whether the data entered into this index must be unique.
TableDesignerIsUniquePropertyTitle = Is Unique
IndexColumnIsAscendingPropertyDescription = Specifies the sort order of the column.
IndexColumnIsAscendingPropertyTitle = Is Ascending
TableDesignerColumnsDisplayValueTitle = Columns

View File

@@ -5702,6 +5702,46 @@
<note>.
Parameters: 0 - underlyingType (string), 1 - columnName (string) </note>
</trans-unit>
<trans-unit id="IndexIsEnabledPropertyDescription">
<source>Specifies whether the index is enabled</source>
<target state="new">Specifies whether the index is enabled</target>
<note></note>
</trans-unit>
<trans-unit id="IndexIsClusteredPropertyDescription">
<source>Whether the index is clustered, only one clustered index is allowed in a table.</source>
<target state="new">Whether the index is clustered, only one clustered index is allowed in a table.</target>
<note></note>
</trans-unit>
<trans-unit id="TableDesignerIndexIsClusteredPropertyTitle">
<source>Is Clustered</source>
<target state="new">Is Clustered</target>
<note></note>
</trans-unit>
<trans-unit id="IndexIsUniquePropertyDescription">
<source>Whether the data entered into this index must be unique.</source>
<target state="new">Whether the data entered into this index must be unique.</target>
<note></note>
</trans-unit>
<trans-unit id="TableDesignerIsUniquePropertyTitle">
<source>Is Unique</source>
<target state="new">Is Unique</target>
<note></note>
</trans-unit>
<trans-unit id="IndexColumnIsAscendingPropertyDescription">
<source>Specifies the sort order of the column.</source>
<target state="new">Specifies the sort order of the column.</target>
<note></note>
</trans-unit>
<trans-unit id="IndexColumnIsAscendingPropertyTitle">
<source>Is Ascending</source>
<target state="new">Is Ascending</target>
<note></note>
</trans-unit>
<trans-unit id="TableDesignerColumnsDisplayValueTitle">
<source>Columns</source>
<target state="new">Columns</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -12,6 +12,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
public const string Description = "description";
public const string Columns = "columns";
public const string ForeignKeys = "foreignKeys";
public const string CheckConstraints = "checkConstraints";
public const string Indexes = "indexes";
}
public static class TableColumnPropertyNames
@@ -52,4 +54,20 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
public const string PrimaryKeyColumn = "primaryKeyColumn";
public const string ForeignKeyColumn = "foreignKeyColumn";
}
public static class IndexPropertyNames
{
public const string Name = "name";
public const string Enabled = "enabled";
public const string IsUnique = "isUnique";
public const string IsClustered = "isClustered";
public const string Columns = "columns";
public const string ColumnsDisplayValue = "columnsDisplayValue";
}
public static class IndexColumnSpecificationPropertyNames
{
public const string Column = "column";
public const string Ascending = "ascending";
}
}

View File

@@ -17,6 +17,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
public BuiltinTableOptions ColumnTableOptions { get; set; } = new BuiltinTableOptions();
public BuiltinTableOptions ForeignKeyTableOptions { get; set; } = new BuiltinTableOptions();
public BuiltinTableOptions CheckConstraintTableOptions { get; set; } = new BuiltinTableOptions();
public BuiltinTableOptions IndexTableOptions { get; set; } = new BuiltinTableOptions();
public BuiltinTableOptions IndexColumnSpecificationTableOptions { get; set; } = new BuiltinTableOptions();
}
public class BuiltinTableOptions

View File

@@ -0,0 +1,32 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Newtonsoft.Json;
namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
{
/// <summary>
/// The view model of index.
/// </summary>
public class IndexViewModel : ObjectViewModelBase
{
public CheckBoxProperties Enabled { get; set; } = new CheckBoxProperties();
public CheckBoxProperties IsClustered { get; set; } = new CheckBoxProperties();
public CheckBoxProperties IsUnique { get; set; } = new CheckBoxProperties();
public InputBoxProperties ColumnsDisplayValue { get; set; } = new InputBoxProperties();
public TableComponentProperties<IndexedColumnSpecification> Columns { get; set; } = new TableComponentProperties<IndexedColumnSpecification>();
}
public class IndexedColumnSpecification
{
public DropdownProperties Column { get; set; } = new DropdownProperties();
public CheckBoxProperties Ascending { get; set; } = new CheckBoxProperties();
}
}

View File

@@ -22,6 +22,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
public TableComponentProperties<CheckConstraintViewModel> CheckConstraints { get; set; } = new TableComponentProperties<CheckConstraintViewModel>();
public TableComponentProperties<IndexViewModel> Indexes { get; set; } = new TableComponentProperties<IndexViewModel>();
public InputBoxProperties Script { get; set; } = new InputBoxProperties();
}
}

View File

@@ -176,13 +176,49 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
case TablePropertyNames.Columns:
table.Columns.AddNew();
break;
case TablePropertyNames.CheckConstraints:
table.CheckConstraints.AddNew();
break;
case TablePropertyNames.ForeignKeys:
table.ForeignKeys.AddNew();
break;
case TablePropertyNames.Indexes:
table.Indexes.AddNew();
break;
default:
break;
}
}
else
else if (path.Length == 3)
{
// TODO: Handle the add item request on second level properties, e.g. Adding a column to an index
var propertyNameL1 = path[0] as string;
var indexL1 = Convert.ToInt32(path[1]);
var propertyNameL2 = path[2] as string;
switch (propertyNameL1)
{
case TablePropertyNames.ForeignKeys:
switch (propertyNameL2)
{
case ForeignKeyPropertyNames.ColumnMapping:
// TODO: handle add item to foreign key's column mapping
break;
default:
break;
}
break;
case TablePropertyNames.Indexes:
switch (propertyNameL2)
{
case IndexPropertyNames.Columns:
// TODO: handle add item to index's column specification
break;
default:
break;
}
break;
default:
break;
}
}
}
@@ -194,53 +230,48 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
if (path.Length == 2)
{
var propertyName = path[0] as string;
var objIndex = Convert.ToInt32(path[1]);
switch (propertyName)
{
case TablePropertyNames.Columns:
table.Columns.RemoveAt(Convert.ToInt32(path[1]));
table.Columns.RemoveAt(objIndex);
break;
case TablePropertyNames.CheckConstraints:
table.CheckConstraints.RemoveAt(objIndex);
break;
case TablePropertyNames.ForeignKeys:
table.ForeignKeys.RemoveAt(objIndex);
break;
case TablePropertyNames.Indexes:
table.Indexes.RemoveAt(objIndex);
break;
default:
break;
}
}
else
else if (path.Length == 4)
{
// TODO: Handle the add item request on second level properties, e.g. Adding a column to an index
}
}
private void HandleUpdateItemRequest(ProcessTableDesignerEditRequestParams requestParams)
{
var table = this.GetTableDesigner(requestParams.TableInfo).TableViewModel;
var path = requestParams.TableChangeInfo.Path;
if (path.Length == 3)
{
var propertyName = path[0] as string;
switch (propertyName)
var propertyNameL1 = path[0] as string;
var indexL1 = Convert.ToInt32(path[1]);
var propertyNameL2 = path[2] as string;
var indexL2 = Convert.ToInt32(path[3]);
switch (propertyNameL1)
{
case TablePropertyNames.Columns:
var colIndex = Convert.ToInt32(path[1]);
var colPropertyName = path[2] as string;
switch (colPropertyName)
case TablePropertyNames.ForeignKeys:
switch (propertyNameL2)
{
case TableColumnPropertyNames.Name:
table.Columns.Items[colIndex].Name = requestParams.TableChangeInfo.Value as string;
case ForeignKeyPropertyNames.ColumnMapping:
// TODO: handle remove item from foreign key's column mapping
break;
case TableColumnPropertyNames.Length:
table.Columns.Items[colIndex].Length = requestParams.TableChangeInfo.Value as string;
default:
break;
case TableColumnPropertyNames.AllowNulls:
table.Columns.Items[colIndex].IsNullable = (bool)requestParams.TableChangeInfo.Value;
break;
case TableColumnPropertyNames.Precision:
table.Columns.Items[colIndex].Precision = Int32.Parse(requestParams.TableChangeInfo.Value as string);
break;
case TableColumnPropertyNames.Scale:
table.Columns.Items[colIndex].Scale = Int32.Parse(requestParams.TableChangeInfo.Value as string);
break;
case TableColumnPropertyNames.Type:
table.Columns.Items[colIndex].DataType = requestParams.TableChangeInfo.Value as string;
}
break;
case TablePropertyNames.Indexes:
switch (propertyNameL2)
{
case IndexPropertyNames.Columns:
// TODO: handle remove item from index's column specification
break;
default:
break;
@@ -252,6 +283,216 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
}
}
private void HandleUpdateItemRequest(ProcessTableDesignerEditRequestParams requestParams)
{
var table = this.GetTableDesigner(requestParams.TableInfo).TableViewModel;
var path = requestParams.TableChangeInfo.Path;
var newValue = requestParams.TableChangeInfo.Value;
if (path.Length == 1)
{
var propertyName = path[0] as string;
switch (propertyName)
{
case TablePropertyNames.Description:
table.Description = GetStringValue(newValue);
break;
case TablePropertyNames.Name:
table.Name = GetStringValue(newValue);
break;
case TablePropertyNames.Schema:
table.Schema = GetStringValue(newValue);
break;
default:
break;
}
}
else if (path.Length == 3)
{
var propertyNameL1 = path[0] as string;
var indexL1 = Convert.ToInt32(path[1]);
var propertyNameL2 = path[2] as string;
switch (propertyNameL1)
{
case TablePropertyNames.Columns:
var column = table.Columns.Items[indexL1];
switch (propertyNameL2)
{
case TableColumnPropertyNames.AllowNulls:
column.IsNullable = GetBooleanValue(newValue);
break;
case TableColumnPropertyNames.DefaultValue:
column.DefaultValue = GetStringValue(newValue);
break;
case TableColumnPropertyNames.IdentityIncrement:
column.IdentityIncrement = GetInt32Value(newValue);
break;
case TableColumnPropertyNames.IdentitySeed:
column.IdentitySeed = GetInt32Value(newValue);
break;
case TableColumnPropertyNames.IsIdentity:
column.IsIdentity = GetBooleanValue(newValue);
break;
case TableColumnPropertyNames.IsPrimaryKey:
column.IsPrimaryKey = GetBooleanValue(newValue);
break;
case TableColumnPropertyNames.Length:
column.Length = GetStringValue(newValue);
break;
case TableColumnPropertyNames.Name:
column.Name = GetStringValue(newValue);
break;
case TableColumnPropertyNames.Precision:
column.Precision = GetInt32Value(newValue);
break;
case TableColumnPropertyNames.Scale:
column.Scale = GetInt32Value(newValue);
break;
case TableColumnPropertyNames.Type:
column.DataType = GetStringValue(newValue);
break;
default:
break;
}
break;
case TablePropertyNames.CheckConstraints:
var checkConstraint = table.CheckConstraints.Items[indexL1];
switch (propertyNameL2)
{
case CheckConstraintPropertyNames.Name:
checkConstraint.Name = GetStringValue(newValue);
break;
case CheckConstraintPropertyNames.Enabled:
checkConstraint.Enabled = GetBooleanValue(newValue);
break;
case CheckConstraintPropertyNames.Expression:
checkConstraint.Expression = GetStringValue(newValue);
break;
default:
break;
}
break;
case TablePropertyNames.ForeignKeys:
var foreignKey = table.ForeignKeys.Items[indexL1];
switch (propertyNameL2)
{
case ForeignKeyPropertyNames.Enabled:
foreignKey.Enabled = GetBooleanValue(newValue);
break;
case ForeignKeyPropertyNames.IsNotForReplication:
foreignKey.IsNotForReplication = GetBooleanValue(newValue);
break;
case ForeignKeyPropertyNames.Name:
foreignKey.Name = GetStringValue(newValue);
break;
case ForeignKeyPropertyNames.OnDeleteAction:
foreignKey.OnDeleteAction = SqlForeignKeyActionUtil.GetValue(GetStringValue(newValue));
break;
case ForeignKeyPropertyNames.OnUpdateAction:
foreignKey.OnUpdateAction = SqlForeignKeyActionUtil.GetValue(GetStringValue(newValue));
break;
case ForeignKeyPropertyNames.PrimaryKeyTable:
foreignKey.PrimaryKeyTable = GetStringValue(newValue);
break;
default:
break;
}
break;
case TablePropertyNames.Indexes:
var sqlIndex = table.Indexes.Items[indexL1];
switch (propertyNameL2)
{
case IndexPropertyNames.Enabled:
sqlIndex.Enabled = GetBooleanValue(newValue);
break;
case IndexPropertyNames.IsClustered:
sqlIndex.IsClustered = GetBooleanValue(newValue);
break;
case IndexPropertyNames.IsUnique:
sqlIndex.IsUnique = GetBooleanValue(newValue);
break;
case IndexPropertyNames.Name:
sqlIndex.Name = GetStringValue(newValue);
break;
default:
break;
}
break;
default:
break;
}
}
else if (path.Length == 5)
{
var propertyNameL1 = path[0] as string;
var indexL1 = Convert.ToInt32(path[1]);
var propertyNameL2 = path[2] as string;
var indexL2 = Convert.ToInt32(path[3]);
var propertyNameL3 = path[4] as string;
switch (propertyNameL1)
{
case TablePropertyNames.ForeignKeys:
// TODO: handle foreign key collection property update
// changes need to be made in DACFX to support it.
switch (propertyNameL2)
{
case ForeignKeyPropertyNames.ColumnMapping:
switch (propertyNameL3)
{
case ForeignKeyColumnMappingPropertyNames.ForeignKeyColumn:
break;
case ForeignKeyColumnMappingPropertyNames.PrimaryKeyColumn:
break;
default:
break;
}
break;
default:
break;
}
break;
case TablePropertyNames.Indexes:
var sqlIndex = table.Indexes.Items[indexL1];
switch (propertyNameL2)
{
case IndexPropertyNames.Columns:
var columnSpec = sqlIndex.Columns[indexL2];
switch (propertyNameL3)
{
case IndexColumnSpecificationPropertyNames.Column:
columnSpec.Column = GetStringValue(newValue);
break;
case IndexColumnSpecificationPropertyNames.Ascending:
columnSpec.isAscending = GetBooleanValue(newValue);
break;
default:
break;
}
break;
default:
break;
}
break;
default:
break;
}
}
}
private int GetInt32Value(object value)
{
return Int32.Parse(value as string);
}
private string GetStringValue(object value)
{
return value as string;
}
private bool GetBooleanValue(object value)
{
return (bool)value;
}
private TableViewModel GetTableViewModel(TableInfo tableInfo)
{
var tableDesigner = this.GetTableDesigner(tableInfo);
@@ -324,6 +565,25 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
tableViewModel.CheckConstraints.Data.Add(constraint);
}
foreach (var index in table.Indexes.Items)
{
var indexVM = new IndexViewModel();
indexVM.Name.Value = index.Name;
indexVM.IsClustered.Checked = index.IsClustered;
indexVM.Enabled.Checked = index.Enabled;
indexVM.IsUnique.Checked = index.IsUnique;
foreach (var columnSpec in index.Columns)
{
var columnSpecVM = new IndexedColumnSpecification();
columnSpecVM.Ascending.Checked = columnSpec.isAscending;
columnSpecVM.Column.Value = columnSpec.Column;
columnSpecVM.Column.Values = table.Columns.Items.Select(c => c.Name).ToList();
indexVM.Columns.Data.Add(columnSpecVM);
}
indexVM.ColumnsDisplayValue.Value = index.ColumnsDisplayValue;
indexVM.ColumnsDisplayValue.Enabled = false;
tableViewModel.Indexes.Data.Add(indexVM);
}
tableViewModel.Script.Enabled = false;
tableViewModel.Script.Value = tableDesigner.Script;
// TODO: set other properties of the table
@@ -333,64 +593,84 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
private TableDesignerView GetDesignerViewInfo(TableInfo tableInfo)
{
var view = new TableDesignerView();
this.SetColumnsViewInfo(view);
this.SetForeignKeysViewInfo(view);
this.SetCheckConstraintsViewInfo(view);
this.SetIndexesViewInfo(view);
return view;
}
private void SetColumnsViewInfo(TableDesignerView view)
{
view.ColumnTableOptions.AdditionalProperties.AddRange(new DesignerDataPropertyInfo[] {
new DesignerDataPropertyInfo()
{
PropertyName = TableColumnPropertyNames.IsIdentity,
Description = SR.TableColumnIsIdentityPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableColumnIsIdentityPropertyTitle
}
}, new DesignerDataPropertyInfo()
{
PropertyName = TableColumnPropertyNames.IdentitySeed,
Description = SR.TableColumnIdentitySeedPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
PropertyName = TableColumnPropertyNames.IsIdentity,
Description = SR.TableColumnIsIdentityPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableColumnIsIdentityPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
Title = SR.TableColumnIdentitySeedPropertyTitle
}
},new DesignerDataPropertyInfo()
{
PropertyName = TableColumnPropertyNames.IdentityIncrement,
Description = SR.TableColumnIdentityIncrementPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
PropertyName = TableColumnPropertyNames.IdentitySeed,
Description = SR.TableColumnIdentitySeedPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
{
Title = SR.TableColumnIdentitySeedPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
Title = SR.TableColumnIdentityIncrementPropertyTitle
PropertyName = TableColumnPropertyNames.IdentityIncrement,
Description = SR.TableColumnIdentityIncrementPropertyDescription,
Group = SR.TableColumnIdentityGroupName,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
{
Title = SR.TableColumnIdentityIncrementPropertyTitle
}
}
}});
});
view.ColumnTableOptions.canAddRows = true;
view.ColumnTableOptions.canRemoveRows = true;
}
private void SetForeignKeysViewInfo(TableDesignerView view)
{
view.ForeignKeyTableOptions.AdditionalProperties.AddRange(new DesignerDataPropertyInfo[] {
new DesignerDataPropertyInfo()
{
PropertyName = ForeignKeyPropertyNames.Enabled,
Description = SR.ForeignKeyIsEnabledDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
new DesignerDataPropertyInfo()
{
Title = SR.TableDesignerIsEnabledPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
PropertyName = ForeignKeyPropertyNames.IsNotForReplication,
Description = SR.ForeignKeyIsNotForReplicationDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
PropertyName = ForeignKeyPropertyNames.Enabled,
Description = SR.ForeignKeyIsEnabledDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableDesignerIsEnabledPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
Title = SR.ForeignKeyIsNotForReplicationTitle
PropertyName = ForeignKeyPropertyNames.IsNotForReplication,
Description = SR.ForeignKeyIsNotForReplicationDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.ForeignKeyIsNotForReplicationTitle
}
}
}});
});
view.ForeignKeyTableOptions.canAddRows = true;
view.ForeignKeyTableOptions.canRemoveRows = true;
}
private void SetCheckConstraintsViewInfo(TableDesignerView view)
{
view.CheckConstraintTableOptions.AdditionalProperties.Add(
new DesignerDataPropertyInfo()
{
@@ -404,7 +684,71 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
});
view.CheckConstraintTableOptions.canAddRows = true;
view.CheckConstraintTableOptions.canRemoveRows = true;
return view;
}
private void SetIndexesViewInfo(TableDesignerView view)
{
view.IndexTableOptions.AdditionalProperties.AddRange(new DesignerDataPropertyInfo[] {
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.ColumnsDisplayValue,
ShowInPropertiesView = false,
ComponentType = DesignerComponentType.Input,
ComponentProperties = new InputBoxProperties()
{
Title = SR.TableDesignerColumnsDisplayValueTitle,
Width = 200
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.Enabled,
Description = SR.IndexIsEnabledPropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableDesignerIsEnabledPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.IsClustered,
Description = SR.IndexIsClusteredPropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableDesignerIndexIsClusteredPropertyTitle
}
},
new DesignerDataPropertyInfo()
{
PropertyName = IndexPropertyNames.IsUnique,
Description = SR.IndexIsUniquePropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.TableDesignerIsUniquePropertyTitle
}
}
});
view.IndexTableOptions.PropertiesToDisplay = new List<string>() { IndexPropertyNames.Name, IndexPropertyNames.ColumnsDisplayValue, IndexPropertyNames.IsClustered, IndexPropertyNames.IsUnique };
view.IndexTableOptions.canAddRows = true;
view.IndexTableOptions.canRemoveRows = true;
view.IndexColumnSpecificationTableOptions.AdditionalProperties.Add(
new DesignerDataPropertyInfo()
{
PropertyName = IndexColumnSpecificationPropertyNames.Ascending,
Description = SR.IndexColumnIsAscendingPropertyDescription,
ComponentType = DesignerComponentType.Checkbox,
ComponentProperties = new CheckBoxProperties()
{
Title = SR.IndexColumnIsAscendingPropertyTitle
}
});
view.IndexColumnSpecificationTableOptions.PropertiesToDisplay.AddRange(new string[] { IndexColumnSpecificationPropertyNames.Column, IndexColumnSpecificationPropertyNames.Ascending });
view.IndexColumnSpecificationTableOptions.canAddRows = true;
view.IndexColumnSpecificationTableOptions.canRemoveRows = true;
}
private Dac.TableDesigner GetTableDesigner(TableInfo tableInfo)