Fixed node labels, status, sub types (#338)

This commit is contained in:
Leila Lali
2017-05-09 09:33:25 -07:00
committed by GitHub
parent 5b5c5861d8
commit 0d570fa29b
25 changed files with 1975 additions and 657 deletions

View File

@@ -20,15 +20,15 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
return null;
}
public override IEnumerable<TreeNode> Expand(TreeNode parent)
public override IEnumerable<TreeNode> Expand(TreeNode parent, bool refresh)
{
try
{
List<TreeNode> allChildren = new List<TreeNode>();
OnExpandPopulateFolders(allChildren, parent);
RemoveFoldersFromInvalidSqlServerVersions(allChildren, parent);
OnExpandPopulateNonFolders(allChildren, parent);
OnExpandPopulateNonFolders(allChildren, parent, refresh);
OnBeginAsyncOperations(parent);
return allChildren;
}
@@ -36,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
}
}
/// <summary>
/// Populates any folders for a given parent node
/// </summary>
@@ -51,7 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
/// </summary>
/// <param name="allChildren">List to which nodes should be added</param>
/// <param name="parent">Parent the nodes are being added to</param>
protected virtual void OnExpandPopulateNonFolders(IList<TreeNode> allChildren, TreeNode parent)
protected virtual void OnExpandPopulateNonFolders(IList<TreeNode> allChildren, TreeNode parent, bool refresh)
{
if (ChildQuerierTypes == null)
{
@@ -60,7 +60,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
}
SmoQueryContext context = parent.GetContextAs<SmoQueryContext>();
Validate.IsNotNull(nameof(context), context);
var validForFlag = ServerVersionHelper.GetValidForFlag(context.SqlServerType);
if (ShouldFilterNode(parent, validForFlag))
{
@@ -73,7 +73,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
string propertyFilter = GetProperyFilter(filters, querier.GetType(), validForFlag);
foreach (var smoObject in querier.Query(context, propertyFilter))
foreach (var smoObject in querier.Query(context, propertyFilter, refresh))
{
if (smoObject == null)
{
@@ -138,7 +138,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
return false;
}
/// <summary>
/// Filters out invalid folders if they cannot be displayed for the current server version
/// </summary>
@@ -163,7 +163,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
throw new NotImplementedException();
}
protected virtual void InitializeChild(TreeNode child, object context)
protected virtual void InitializeChild(TreeNode parent, TreeNode child, object context)
{
NamedSmoObject smoObj = context as NamedSmoObject;
if (smoObj == null)
@@ -174,10 +174,22 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
SmoTreeNode childAsMeItem = (SmoTreeNode)child;
childAsMeItem.CacheInfoFromModel(smoObj);
SmoQueryContext smoContext = parent.GetContextAs<SmoQueryContext>();
// If node has custom name, replaced it with the name already set
string customizedName = GetNodeCustomName(context, smoContext);
if (!string.IsNullOrEmpty(customizedName))
{
childAsMeItem.NodeValue = customizedName;
}
childAsMeItem.NodeSubType = GetNodeSubType(context);
childAsMeItem.NodeStatus = GetNodeStatus(context);
}
}
internal virtual Type[] ChildQuerierTypes {
internal virtual Type[] ChildQuerierTypes
{
get
{
return null;
@@ -203,5 +215,20 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
return true;
}
public override string GetNodeSubType(object context)
{
return string.Empty;
}
public override string GetNodeStatus(object context)
{
return string.Empty;
}
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return string.Empty;
}
}
}

View File

@@ -0,0 +1,267 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Globalization;
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Custom name for Columns
/// </summary>
internal partial class ColumnsChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
/// <summary>
/// Custom name for UserDefinedTableTypeColumn
/// </summary>
internal partial class UserDefinedTableTypeColumnsChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
static class SmoColumnCustomNodeHelper
{
private const string SimpleColumnLabelWithType = "{0} ({1}{2}, {3})";
private const string SimpleColumnLabelWithoutType = "{0} ({1})";
private const string SimpleColumnLabelWithTypeAndKeyString = "{0} ({1}, {2}, {3})";
internal static string CalculateCustomLabel(object context, SmoQueryContext smoContext)
{
UserDefinedDataTypeCollection uddts = null;
if (smoContext != null)
{
uddts = smoContext.Database.UserDefinedDataTypes;
}
Column column = context as Column;
if(column != null)
{
return GetCustomizedLabel(column, uddts);
}
return string.Empty;
}
private static string GetCustomizedLabel(Column column, UserDefinedDataTypeCollection uddts)
{
if (column.Computed)
{
return GetComutedColumnLabel(column, uddts);
}
else if (column.IsColumnSet)
{
return GetColumnSetLabel(column, uddts);
}
else
{
return GetSimpleColumnLabel(column, uddts);
}
}
private static string GetTypeSpecifierLabel(DataType dataType, UserDefinedDataTypeCollection uddts)
{
string typeName = string.Empty;
if (dataType != null)
{
// typeSpecifier might still be in a resolve candidate status. If so then the
// name might be null. Don't ask for the type specifier name in this case.
typeName = dataType.Name;
// This may return [dbo].[MyType], but for the purposes of display we only want MyType
if (!string.IsNullOrWhiteSpace(typeName) &&
typeName.EndsWith("]", StringComparison.Ordinal))
{
int nameStart = typeName.LastIndexOf('[');
typeName = typeName.Substring(nameStart + 1, typeName.Length - nameStart - 2);
}
if(dataType.SqlDataType == SqlDataType.UserDefinedDataType && uddts != null && uddts.Contains(dataType.Name))
{
var uddt = uddts[dataType.Name];
typeName += $"({uddt.SystemType})";
}
// These types support Length
switch (dataType.SqlDataType)
{
case SqlDataType.Char:
case SqlDataType.NChar:
case SqlDataType.Binary:
case SqlDataType.VarChar: // Supports Max Length
case SqlDataType.NVarChar: // Supports Max Length
case SqlDataType.VarBinary: // Supports Max Length
typeName += "(";
if (dataType.MaximumLength == 0)
{
typeName += "max";
}
else
{
typeName += dataType.MaximumLength;
}
typeName += ")";
break;
}
}
return typeName;
}
private static string GetKeyString(Column column)
{
// Get if it's a PK or FK (or both)
// Here's how it could be both...notice t2c1 is both a primary and foreign key
//
// Create table t1 (t1c1 int, t1c2 int not null primary key)
// Create table t2 (t2c1 int primary key, t2c2 int not null)
// Alter table t2 add FOREIGN KEY(t2c1) references t1(t1c2)
//
string keyString = null;
if (column.InPrimaryKey)
keyString = "PK";
if (column.IsForeignKey)
{
keyString = (keyString == null) ? "FK" :
"PK, FK";
}
return keyString;
}
private static string GetColumnSetLabel(Column column, UserDefinedDataTypeCollection uddts)
{
// This is the simple name
string label = column.Name;
// Get the column type
string columnType = GetTypeSpecifierLabel(column.DataType, uddts);
string keyString = GetKeyString(column);
if (keyString != null && !string.IsNullOrWhiteSpace(columnType))
{
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_ColumnSetLabelWithTypeAndKeyString,
label,
keyString,
columnType,
SR.SchemaHierarchy_NullColumn_Label);
}
if (!string.IsNullOrWhiteSpace(columnType))
{
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_ColumnSetLabelWithType,
label,
keyString,
columnType,
SR.SchemaHierarchy_NullColumn_Label);
}
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_ColumnSetLabelWithoutType,
label,
SR.SchemaHierarchy_NullColumn_Label);
}
private static string GetSimpleColumnLabel(Column column, UserDefinedDataTypeCollection uddts)
{
// This is the simple name
string label = column.Name;
// Get the nullability
string isNullable = column.Nullable ? SR.SchemaHierarchy_NullColumn_Label : SR.SchemaHierarchy_NotNullColumn_Label;
// Get the column type
string columnType = GetTypeSpecifierLabel(column.DataType, uddts);
string keyString = GetKeyString(column);
if (keyString != null && !string.IsNullOrWhiteSpace(columnType))
{
return string.Format(CultureInfo.InvariantCulture,
SimpleColumnLabelWithTypeAndKeyString,
label,
keyString,
columnType,
isNullable);
}
if (!string.IsNullOrWhiteSpace(columnType))
{
return string.Format(CultureInfo.InvariantCulture,
SimpleColumnLabelWithType,
label,
keyString,
columnType,
isNullable);
}
return string.Format(CultureInfo.InvariantCulture,
SimpleColumnLabelWithoutType,
label,
isNullable);
}
private static string GetComutedColumnLabel(Column column, UserDefinedDataTypeCollection uddts)
{
string columnType = null;
// Display the type name as fully qualified
string label = column.Name;
// Get the nullability
string isNullable = column.Nullable ? SR.SchemaHierarchy_NullColumn_Label : SR.SchemaHierarchy_NotNullColumn_Label;
string keyString = GetKeyString(column);
// Get the column type
columnType = GetTypeSpecifierLabel(column.DataType, uddts);
if (!string.IsNullOrWhiteSpace(columnType))
{
if (column.Parent is View)
{
// View columns are always computed, but SSMS shows then as never computed, so
// treat them as simple columns
return string.Format(CultureInfo.InvariantCulture,
SimpleColumnLabelWithType,
label,
keyString,
columnType,
isNullable);
}
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_ComputedColumnLabelWithType,
label,
keyString,
columnType,
isNullable);
}
if (column.Parent is View)
{
return string.Format(CultureInfo.InvariantCulture,
SimpleColumnLabelWithoutType,
label,
keyString);
}
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_ComputedColumnLabelWithoutType,
label,
keyString);
}
}
}

View File

@@ -0,0 +1,90 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Subtye for keys
/// </summary>
internal partial class KeysChildFactory : SmoChildFactoryBase
{
public override string GetNodeSubType(object context)
{
return IndexCustomeNodeHelper.GetSubType(context);
}
}
/// <summary>
/// Sub types and custom name for indexes
/// </summary>
internal partial class IndexesChildFactory : SmoChildFactoryBase
{
public override string GetNodeSubType(object context)
{
return IndexCustomeNodeHelper.GetSubType(context);
}
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return IndexCustomeNodeHelper.GetCustomLabel(smoObject);
}
}
/// <summary>
/// sub type for UserDefinedTableTypeKeys
/// </summary>
internal partial class UserDefinedTableTypeKeysChildFactory : SmoChildFactoryBase
{
public override string GetNodeSubType(object context)
{
return IndexCustomeNodeHelper.GetSubType(context);
}
}
internal static class IndexCustomeNodeHelper
{
internal static string GetCustomLabel(object context)
{
Index index = context as Index;
if (index != null)
{
string name = index.Name;
string unique = index.IsUnique ? SR.UniqueIndex_LabelPart : SR.NonUniqueIndex_LabelPart;
string clustered = index.IsClustered ? SR.ClusteredIndex_LabelPart : SR.NonClusteredIndex_LabelPart;
name = name + $" ({unique}, {clustered})";
return name;
}
return string.Empty;
}
internal static string GetSubType(object context)
{
Index index = context as Index;
if (index != null)
{
switch (index.IndexKeyType)
{
case IndexKeyType.DriPrimaryKey:
return "PrimaryKey";
case IndexKeyType.DriUniqueKey:
return "UniqueKey";
}
}
ForeignKey foreignKey = context as ForeignKey;
if (foreignKey != null)
{
return "ForeignKey";
}
return string.Empty;
}
}
}

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Status for logins
/// </summary>
internal partial class ServerLevelLoginsChildFactory : SmoChildFactoryBase
{
public override string GetNodeStatus(object context)
{
return LoginCustomeNodeHelper.GetStatus(context);
}
}
internal static class LoginCustomeNodeHelper
{
internal static string GetStatus(object context)
{
Login login = context as Login;
if (login != null)
{
if (login.IsDisabled)
{
return "Disabled";
}
}
return string.Empty;
}
}
}

View File

@@ -0,0 +1,104 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Globalization;
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Custom name for parameters
/// </summary>
internal partial class TableValuedFunctionParametersChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return ParameterCustomeNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
/// <summary>
/// Custom name for parameters
/// </summary>
internal partial class ScalarValuedFunctionParametersChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return ParameterCustomeNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
/// <summary>
/// Custom name for parameters
/// </summary>
internal partial class AggregateFunctionParametersChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return ParameterCustomeNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
/// <summary>
/// Custom name for parameters
/// </summary>
internal partial class StoredProcedureParametersChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
return ParameterCustomeNodeHelper.CalculateCustomLabel(smoObject, smoContext);
}
}
static class ParameterCustomeNodeHelper
{
internal static string CalculateCustomLabel(object context, SmoQueryContext smoContext)
{
Parameter parameter = context as Parameter;
if (parameter != null)
{
return ParameterCustomeNodeHelper.GetParameterCustomLabel(parameter);
}
return string.Empty;
}
internal static string GetParameterCustomLabel(Parameter parameter)
{
string label = parameter.Name;
string defaultString = SR.SchemaHierarchy_SubroutineParameterNoDefaultLabel;
string inputOutputString = SR.SchemaHierarchy_SubroutineParameterInputLabel;
string typeName = parameter.DataType.ToString();
if (parameter.DefaultValue != null &&
!string.IsNullOrEmpty(parameter.DefaultValue))
{
defaultString = SR.SchemaHierarchy_SubroutineParameterDefaultLabel;
}
StoredProcedureParameter stordProcedureParameter = parameter as StoredProcedureParameter;
if (stordProcedureParameter != null && stordProcedureParameter.IsOutputParameter)
{
inputOutputString = SR.SchemaHierarchy_SubroutineParameterInputOutputLabel;
if (parameter.IsReadOnly)
{
inputOutputString = SR.SchemaHierarchy_SubroutineParameterInputOutputReadOnlyLabel;
}
}
else if (parameter.IsReadOnly)
{
inputOutputString = SR.SchemaHierarchy_SubroutineParameterInputReadOnlyLabel;
}
return string.Format(CultureInfo.InvariantCulture,
SR.SchemaHierarchy_SubroutineParameterLabelFormatString,
label,
typeName,
inputOutputString,
defaultString);
}
}
}

View File

@@ -28,7 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public abstract IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter);
public abstract IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh);
internal IMultiServiceProvider ServiceProvider
{

View File

@@ -52,7 +52,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
WriteLine("");
// Query impl
WriteLine("public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter)");
WriteLine("public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)");
WriteLine("{");
PushIndent(indent);
@@ -67,6 +67,13 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
WriteLine("bool hasFilter = !string.IsNullOrEmpty(filter);");
string navigationPath = GetNavigationPath(nodeElement, xmlFile, nodeName, parentType);
WriteLine("if (refresh)");
WriteLine("{");
PushIndent(indent);
WriteLine(string.Format("{0}.{1}.Refresh();", parentVar, navigationPath));
PopIndent();
WriteLine("}");
WriteLine(string.Format("var retValue = {0}.{1};", parentVar, navigationPath));
WriteLine("if (retValue != null)");
WriteLine("{");

View File

@@ -63,8 +63,10 @@
<NavigationPath Parent="Database" Field="Assemblies" />
</Node>
<!-- Deprecated
<Node Name="SqlRule" Parent="Database" />
<Node Name="SqlDefault" Parent="Database" />
-->
<Node Name="SqlSequence" Parent="Database" />
<Node Name="SqlUserDefinedDataType" Parent="Database" />

View File

@@ -0,0 +1,54 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Custom name for table
/// </summary>
internal partial class TablesChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
Table table = smoObject as Table;
if (table != null && table.IsSystemVersioned)
{
return $"{table.Name} ({SR.SystemVersioned_LabelPart})";
}
return string.Empty;
}
}
/// <summary>
/// Custom name for history table
/// </summary>
internal partial class TableChildFactory : SmoChildFactoryBase
{
public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
{
Table table = smoObject as Table;
if (table != null)
{
return $"{table.Name} ({SR.History_LabelPart})";
}
return string.Empty;
}
public override string GetNodeSubType(object context)
{
Table table = context as Table;
if (table != null)
{
return "History";
}
return string.Empty;
}
}
}

View File

@@ -1,77 +1,77 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// A Node in the tree representing a SMO-based object
/// </summary>
public class SmoTreeNode : TreeNode
{
public static int FolderSortPriority = 0;
private static int _nextSortPriority = FolderSortPriority + 1; // 0 is reserved for folders
protected SmoQueryContext context;
public SmoTreeNode() : base()
{
}
protected virtual void OnInitialize()
{
// TODO setup initialization
}
/// <summary>
/// Is this a system (MSShipped) object?
/// </summary>
public bool IsMsShippedOwned { get; set; }
/// <summary>
/// Indicates which platforms a node is valid for
/// </summary>
public ValidForFlag ValidFor { get; set; }
/// <summary>
/// Gets an incrementing sort priority value to assist in automatically sorting
/// elements in a tree
/// </summary>
public static int NextSortPriority
{
get
{
return System.Threading.Interlocked.Increment(ref _nextSortPriority);
}
}
public NamedSmoObject SmoObject { get; private set; }
public virtual void CacheInfoFromModel(NamedSmoObject smoObject)
{
SmoObject = smoObject;
NodeValue = smoObject.Name;
ScriptSchemaObjectBase schemaBasecObject = smoObject as ScriptSchemaObjectBase;
ObjectMetadata = new Metadata.Contracts.ObjectMetadata();
ObjectMetadata.Name = smoObject.Name;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Globalization;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// A Node in the tree representing a SMO-based object
/// </summary>
public class SmoTreeNode : TreeNode
{
public static int FolderSortPriority = 0;
private static int _nextSortPriority = FolderSortPriority + 1; // 0 is reserved for folders
protected SmoQueryContext context;
public SmoTreeNode() : base()
{
}
protected virtual void OnInitialize()
{
// TODO setup initialization
}
/// <summary>
/// Is this a system (MSShipped) object?
/// </summary>
public bool IsMsShippedOwned { get; set; }
/// <summary>
/// Indicates which platforms a node is valid for
/// </summary>
public ValidForFlag ValidFor { get; set; }
/// <summary>
/// Gets an incrementing sort priority value to assist in automatically sorting
/// elements in a tree
/// </summary>
public static int NextSortPriority
{
get
{
return System.Threading.Interlocked.Increment(ref _nextSortPriority);
}
}
public NamedSmoObject SmoObject { get; private set; }
public virtual void CacheInfoFromModel(NamedSmoObject smoObject)
{
SmoObject = smoObject;
NodeValue = smoObject.Name;
ScriptSchemaObjectBase schemaBasecObject = smoObject as ScriptSchemaObjectBase;
ObjectMetadata = new Metadata.Contracts.ObjectMetadata();
ObjectMetadata.Name = smoObject.Name;
try
{
if(smoObject.Urn != null)
{
ObjectMetadata.MetadataTypeName = smoObject.Urn.Type;
}
}
}
catch
{
//Ignore the exception, sometimes the urn returns exception and I' not sure why
}
}
if (schemaBasecObject != null)
{
ObjectMetadata.Schema = schemaBasecObject.Schema;
@@ -79,36 +79,36 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
NodeValue = $"{ObjectMetadata.Schema}.{smoObject.Name}";
}
}
}
public virtual NamedSmoObject GetParentSmoObject()
{
if (SmoObject != null)
{
return SmoObject;
}
// Return the parent's object, or null if it's not set / not a SmoTreeNode
return ParentAs<SmoTreeNode>()?.GetParentSmoObject();
}
public override object GetContext()
{
EnsureContextInitialized();
return context;
}
protected virtual void EnsureContextInitialized()
{
if (context == null)
{
SmoObjectBase smoParent = GetParentSmoObject();
SmoQueryContext parentContext = Parent?.GetContextAs<SmoQueryContext>();
if (smoParent != null && parentContext != null)
{
context = parentContext.CopyWithParent(smoParent);
}
}
}
}
}
}
}
public virtual NamedSmoObject GetParentSmoObject()
{
if (SmoObject != null)
{
return SmoObject;
}
// Return the parent's object, or null if it's not set / not a SmoTreeNode
return ParentAs<SmoTreeNode>()?.GetParentSmoObject();
}
public override object GetContext()
{
EnsureContextInitialized();
return context;
}
protected virtual void EnsureContextInitialized()
{
if (context == null)
{
SmoObjectBase smoParent = GetParentSmoObject();
SmoQueryContext parentContext = Parent?.GetContextAs<SmoQueryContext>();
if (smoParent != null && parentContext != null)
{
context = parentContext.CopyWithParent(smoParent);
}
}
}
}
}

View File

@@ -0,0 +1,40 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Status for triggers
/// </summary>
public class SmoTriggerCustomNode
{
internal partial class TriggersChildFactory : SmoChildFactoryBase
{
public override string GetNodeStatus(object context)
{
return TriggersCustomeNodeHelper.GetStatus(context);
}
}
}
internal static class TriggersCustomeNodeHelper
{
internal static string GetStatus(object context)
{
Trigger trigger = context as Trigger;
if (trigger != null)
{
if (!trigger.IsEnabled)
{
return "Disabled";
}
}
return string.Empty;
}
}
}

View File

@@ -71,8 +71,10 @@
</Filter>
</Filters>
<Child Name="SystemTables"/>
<!--
<Child Name="FileTables"/>
<Child Name="ExternalTables"/>
-->
</Node>
<Node Name="Views" LocLabel="SR.SchemaHierarchy_Views" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlView" TreeNode="ViewTreeNode">
@@ -89,8 +91,10 @@
<Child Name="DatabaseTriggers"/>
<Child Name="Assemblies"/>
<Child Name="Types"/>
<!--
<Child Name="Rules"/>
<Child Name="Defaults"/>
-->
<Child Name="Sequences"/>
</Node>
<Node Name="ExternalResources" LocLabel="SR.SchemaHierarchy_ExternalResources" BaseClass="ModelBased" TreeNode="ExternalResourceTreeNode" ValidFor="Sql2016|SqlvNext|AzureV12">
@@ -139,6 +143,7 @@
<Filter Property="IsSystemObject" Value="1" Type="bool" />
</Filters>
</Node>
<!--
<Node Name="FileTables" LocLabel="SR.SchemaHierarchy_FileTables" BaseClass="ModelBased" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlTable" TreeNode="TableTreeNode" ValidFor="Sql2012|Sql2014|Sql2016|SqlvNext|NotDebug">
<Filters >
<Filter Property="IsFileTable" Value="1" Type="bool" />
@@ -149,9 +154,8 @@
<Filter Property="IsExternal" Value="1" Type="bool" />
</Filters>
</Node>
-->
<Node Name="Table" LocLabel="string.Empty" BaseClass="ModelBased" IsAsyncLoad="" Strategy="MultipleElementsOfType" ChildQuerierTypes="SqlTable;SqlHistoryTable" TreeNode="HistoryTableTreeNode">
<!-- TODO Add special history table handling to only return related history table instead of all! Under Table, we directly show any related history tables.-->
<Filters>
<Filter TypeToReverse="SqlHistoryTable" Property="TemporalType" Type="Enum" ValidFor="Sql2016|SqlvNext|AzureV12">
<Value>TableTemporalType.HistoryTable</Value>
@@ -228,8 +232,10 @@
<Child Name="UserDefinedTypes"/>
<Child Name="XmlSchemaCollections"/>
</Node>
<!--==
<Node Name="Rules" LocLabel="SR.SchemaHierarchy_Rules" BaseClass="ModelBased" Strategy="MultipleElementsOfType" NodeType="Rule" ChildQuerierTypes="SqlRule" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
<Node Name="Defaults" LocLabel="SR.SchemaHierarchy_Defaults" BaseClass="ModelBased" Strategy="MultipleElementsOfType" NodeType="Default" ChildQuerierTypes="SqlDefault" ValidFor="Sql2005|Sql2008|Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
-->
<Node Name="Sequences" LocLabel="SR.SchemaHierarchy_Sequences" BaseClass="ModelBased" Strategy="MultipleElementsOfType" NodeType="Sequence" ChildQuerierTypes="SqlSequence" ValidFor="Sql2012|Sql2014|Sql2016|SqlvNext|AzureV12"/>
<Node Name="SystemDataTypes" LocLabel="SR.SchemaHierarchy_SystemDataTypes" BaseClass="ModelBased" >

View File

@@ -199,7 +199,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new DatabaseTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -341,7 +341,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelLinkedServerLogin";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -365,7 +365,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelLogin";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -389,7 +389,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelServerRole";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -413,7 +413,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelCredential";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -437,7 +437,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelCryptographicProvider";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -461,7 +461,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelServerAudit";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -485,7 +485,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelServerAuditSpecification";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -509,7 +509,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelEndpoint";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -533,7 +533,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelLinkedServer";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -557,7 +557,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelServerTrigger";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -581,7 +581,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ServerLevelErrorMessage";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -659,7 +659,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Database";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -718,20 +718,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
IsMsShippedOwned = true,
SortPriority = SmoTreeNode.NextSortPriority,
});
currentChildren.Add(new FolderNode {
NodeValue = SR.SchemaHierarchy_FileTables,
NodeType = "Folder",
NodeTypeId = NodeTypes.FileTables,
ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016,
SortPriority = SmoTreeNode.NextSortPriority,
});
currentChildren.Add(new FolderNode {
NodeValue = SR.SchemaHierarchy_ExternalTables,
NodeType = "Folder",
NodeTypeId = NodeTypes.ExternalTables,
ValidFor = ValidForFlag.Sql2016|ValidForFlag.AzureV12,
SortPriority = SmoTreeNode.NextSortPriority,
});
}
internal override Type[] ChildQuerierTypes
@@ -745,7 +731,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new TableTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -793,7 +779,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new ViewTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -817,7 +803,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Synonym";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -861,20 +847,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
NodeTypeId = NodeTypes.Types,
SortPriority = SmoTreeNode.NextSortPriority,
});
currentChildren.Add(new FolderNode {
NodeValue = SR.SchemaHierarchy_Rules,
NodeType = "Folder",
NodeTypeId = NodeTypes.Rules,
ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12,
SortPriority = SmoTreeNode.NextSortPriority,
});
currentChildren.Add(new FolderNode {
NodeValue = SR.SchemaHierarchy_Defaults,
NodeType = "Folder",
NodeTypeId = NodeTypes.Defaults,
ValidFor = ValidForFlag.Sql2005|ValidForFlag.Sql2008|ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.AzureV12,
SortPriority = SmoTreeNode.NextSortPriority,
});
currentChildren.Add(new FolderNode {
NodeValue = SR.SchemaHierarchy_Sequences,
NodeType = "Folder",
@@ -1177,81 +1149,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new TableTreeNode();
InitializeChild(child, context);
return child;
}
}
[Export(typeof(ChildFactory))]
[Shared]
internal partial class FileTablesChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "FileTables" }; }
public override IEnumerable<NodeFilter> Filters
{
get
{
var filters = new List<NodeFilter>();
filters.Add(new NodeFilter
{
Property = "IsFileTable",
Type = typeof(bool),
Values = new List<object> { 1 },
});
return filters;
}
}
internal override Type[] ChildQuerierTypes
{
get
{
return new [] { typeof(SqlTableQuerier), };
}
}
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new TableTreeNode();
InitializeChild(child, context);
return child;
}
}
[Export(typeof(ChildFactory))]
[Shared]
internal partial class ExternalTablesChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "ExternalTables" }; }
public override IEnumerable<NodeFilter> Filters
{
get
{
var filters = new List<NodeFilter>();
filters.Add(new NodeFilter
{
Property = "IsExternal",
Type = typeof(bool),
Values = new List<object> { 1 },
});
return filters;
}
}
internal override Type[] ChildQuerierTypes
{
get
{
return new [] { typeof(SqlTableQuerier), };
}
}
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new ExternalTableTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1333,7 +1231,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new HistoryTableTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1384,7 +1282,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Table";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1424,7 +1322,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Table";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1449,7 +1347,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "Column";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1494,7 +1392,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Key";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1518,7 +1416,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Constraint";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1542,7 +1440,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Trigger";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1586,7 +1484,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Index";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1610,7 +1508,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Statistic";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1647,7 +1545,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new ViewTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1698,7 +1596,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "View";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1760,7 +1658,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "DatabaseTrigger";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1784,7 +1682,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Assembly";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -1841,54 +1739,6 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
}
}
[Export(typeof(ChildFactory))]
[Shared]
internal partial class RulesChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "Rules" }; }
internal override Type[] ChildQuerierTypes
{
get
{
return new [] { typeof(SqlRuleQuerier), };
}
}
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Rule";
InitializeChild(child, context);
return child;
}
}
[Export(typeof(ChildFactory))]
[Shared]
internal partial class DefaultsChildFactory : SmoChildFactoryBase
{
public override IEnumerable<string> ApplicableParents() { return new[] { "Defaults" }; }
internal override Type[] ChildQuerierTypes
{
get
{
return new [] { typeof(SqlDefaultQuerier), };
}
}
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Default";
InitializeChild(child, context);
return child;
}
}
[Export(typeof(ChildFactory))]
[Shared]
internal partial class SequencesChildFactory : SmoChildFactoryBase
@@ -1908,7 +1758,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Sequence";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2007,7 +1857,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedDataType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2029,7 +1879,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new UserDefinedTableTypeTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2053,7 +1903,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2077,7 +1927,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "XmlSchemaCollection";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2122,7 +1972,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedTableType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2147,7 +1997,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedTableTypeColumn";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2192,7 +2042,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedTableTypeKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2216,7 +2066,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "UserDefinedTableTypeConstraint";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2240,7 +2090,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemExactNumeric";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2264,7 +2114,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemApproximateNumeric";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2288,7 +2138,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemDateAndTime";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2312,7 +2162,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemCharacterString";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2336,7 +2186,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemUnicodeCharacterString";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2360,7 +2210,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemBinaryString";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2384,7 +2234,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemOtherDataType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2408,7 +2258,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemClrDataType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2432,7 +2282,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemSpatialDataType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2456,7 +2306,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ExternalDataSource";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2480,7 +2330,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ExternalFileFormat";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2528,7 +2378,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new StoredProcedureTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2565,7 +2415,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new StoredProcedureTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2598,7 +2448,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "StoredProcedure";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2623,7 +2473,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "StoredProcedureParameter";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2670,7 +2520,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new TableValuedFunctionTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2703,7 +2553,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "TableValuedFunction";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2728,7 +2578,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "TableValuedFunctionParameter";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2775,7 +2625,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new ScalarValuedFunctionTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2808,7 +2658,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ScalarValuedFunction";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2833,7 +2683,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "ScalarValuedFunctionParameter";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2855,7 +2705,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new AggregateFunctionTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2888,7 +2738,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "AggregateFunction";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2913,7 +2763,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
child.IsAlwaysLeaf = true;
child.NodeType = "AggregateFunctionParameter";
child.SortPriority = SmoTreeNode.NextSortPriority;
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2937,7 +2787,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "RemoteServiceBinding";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2961,7 +2811,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "BrokerPriority";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -2983,7 +2833,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
public override TreeNode CreateChild(TreeNode parent, object context)
{
var child = new FileGroupTreeNode();
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3007,7 +2857,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "FullTextCatalog";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3031,7 +2881,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "FullTextStopList";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3055,7 +2905,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SqlLogFile";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3079,7 +2929,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "PartitionFunction";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3103,7 +2953,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "PartitionScheme";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3127,7 +2977,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SearchPropertyList";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3176,7 +3026,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "FileGroupFile";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3200,7 +3050,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "User";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3256,7 +3106,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Schema";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3280,7 +3130,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "AsymmetricKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3304,7 +3154,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Certificate";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3328,7 +3178,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SymmetricKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3352,7 +3202,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "DatabaseEncryptionKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3376,7 +3226,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "MasterKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3400,7 +3250,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "DatabaseAuditSpecification";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3424,7 +3274,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SecurityPolicie";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3448,7 +3298,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "DatabaseScopedCredential";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3505,7 +3355,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "DatabaseRole";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3529,7 +3379,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ApplicationRole";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3553,7 +3403,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ColumnMasterKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3577,7 +3427,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "ColumnEncryptionKey";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3612,7 +3462,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "MessageType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3636,7 +3486,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemMessageType";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3671,7 +3521,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Contract";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3695,7 +3545,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemContract";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3730,7 +3580,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Queue";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3754,7 +3604,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemQueue";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3789,7 +3639,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "Service";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}
@@ -3813,7 +3663,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
var child = new SmoTreeNode();
child.IsAlwaysLeaf = true;
child.NodeType = "SystemService";
InitializeChild(child, context);
InitializeChild(parent, child, context);
return child;
}
}

View File

@@ -277,7 +277,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
WriteLine(" child.SortPriority = SmoTreeNode.NextSortPriority;");
}
WriteLine(" InitializeChild(child, context);");
WriteLine(" InitializeChild(parent, child, context);");
WriteLine(" return child;");