Load properties used for OE node status by group instead of individually (#706)

This commit is contained in:
Matt Irvine
2018-10-11 10:41:48 -07:00
committed by GitHub
parent a468a8b594
commit 8fe3d06068
6 changed files with 174 additions and 1 deletions

View File

@@ -4,9 +4,11 @@
// //
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
using Microsoft.SqlTools.Utility; using Microsoft.SqlTools.Utility;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
@@ -20,6 +22,81 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
return SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext); return SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return new List<NodeSmoProperty>
{
new NodeSmoProperty
{
Name = "Computed",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "IsColumnSet",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "Nullable",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "DataType",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "InPrimaryKey",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "IsForeignKey",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "SystemType",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "Length",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "NumericPrecision",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "NumericScale",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "XmlSchemaNamespaceSchema",
ValidFor = ValidForFlag.NotSqlDw
},
new NodeSmoProperty
{
Name = "XmlSchemaNamespace",
ValidFor = ValidForFlag.NotSqlDw
},
new NodeSmoProperty
{
Name = "XmlDocumentConstraint",
ValidFor = ValidForFlag.NotSqlDw
}
};
}
}
} }
/// <summary> /// <summary>

View File

@@ -3,9 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// //
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes; using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
using System.Collections.Generic;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {

View File

@@ -3,7 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// //
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
@@ -23,6 +25,31 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
/// </summary> /// </summary>
internal partial class IndexesChildFactory : SmoChildFactoryBase internal partial class IndexesChildFactory : SmoChildFactoryBase
{ {
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return new List<NodeSmoProperty>
{
new NodeSmoProperty
{
Name = "IsUnique",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "IsClustered",
ValidFor = ValidForFlag.All
},
new NodeSmoProperty
{
Name = "IndexKeyType",
ValidFor = ValidForFlag.All
}
};
}
}
public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext) public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext)
{ {
return IndexCustomeNodeHelper.GetSubType(smoObject); return IndexCustomeNodeHelper.GetSubType(smoObject);

View File

@@ -3,7 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// //
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
@@ -16,6 +18,21 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
return LoginCustomNodeHelper.GetStatus(smoObject); return LoginCustomNodeHelper.GetStatus(smoObject);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return new List<NodeSmoProperty>
{
new NodeSmoProperty
{
Name = "IsDisabled",
ValidFor = ValidForFlag.All
}
};
}
}
} }
internal static class LoginCustomNodeHelper internal static class LoginCustomNodeHelper

View File

@@ -3,7 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// //
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
@@ -12,10 +14,27 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
/// </summary> /// </summary>
internal partial class TriggersChildFactory : SmoChildFactoryBase internal partial class TriggersChildFactory : SmoChildFactoryBase
{ {
public static readonly List<NodeSmoProperty> SmoPropertyList = new List<NodeSmoProperty>
{
new NodeSmoProperty
{
Name = "IsEnabled",
ValidFor = ValidForFlag.All
}
};
public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext) public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext)
{ {
return TriggersCustomeNodeHelper.GetStatus(smoObject); return TriggersCustomeNodeHelper.GetStatus(smoObject);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return TriggersChildFactory.SmoPropertyList;
}
}
} }
internal partial class ServerLevelServerTriggersChildFactory : SmoChildFactoryBase internal partial class ServerLevelServerTriggersChildFactory : SmoChildFactoryBase
@@ -24,6 +43,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
return TriggersCustomeNodeHelper.GetStatus(smoObject); return TriggersCustomeNodeHelper.GetStatus(smoObject);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return TriggersChildFactory.SmoPropertyList;
}
}
} }
internal partial class DatabaseTriggersChildFactory : SmoChildFactoryBase internal partial class DatabaseTriggersChildFactory : SmoChildFactoryBase
@@ -32,6 +59,14 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
return TriggersCustomeNodeHelper.GetStatus(smoObject); return TriggersCustomeNodeHelper.GetStatus(smoObject);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return TriggersChildFactory.SmoPropertyList;
}
}
} }
internal static class TriggersCustomeNodeHelper internal static class TriggersCustomeNodeHelper

View File

@@ -3,7 +3,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
// //
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
@@ -16,6 +18,21 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{ {
return UserCustomeNodeHelper.GetStatus(smoObject); return UserCustomeNodeHelper.GetStatus(smoObject);
} }
public override IEnumerable<NodeSmoProperty> SmoProperties
{
get
{
return new List<NodeSmoProperty>
{
new NodeSmoProperty
{
Name = "HasDBAccess",
ValidFor = ValidForFlag.All
}
};
}
}
} }
internal static class UserCustomeNodeHelper internal static class UserCustomeNodeHelper