mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 17:23:38 -05:00
Bug fix for https://github.com/Microsoft/azuredatastudio/issues/2923 and misc other fixes (#711)
This commit is contained in:
@@ -23,80 +23,76 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
return SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext);
|
||||
}
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
get
|
||||
new NodeSmoProperty
|
||||
{
|
||||
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
|
||||
}
|
||||
};
|
||||
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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
@@ -25,30 +26,26 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
/// </summary>
|
||||
internal partial class IndexesChildFactory : SmoChildFactoryBase
|
||||
{
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
get
|
||||
new NodeSmoProperty
|
||||
{
|
||||
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
|
||||
}
|
||||
};
|
||||
Name = "IsUnique",
|
||||
ValidFor = ValidForFlag.All
|
||||
},
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsClustered",
|
||||
ValidFor = ValidForFlag.All
|
||||
},
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IndexKeyType",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
|
||||
public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
@@ -18,21 +19,17 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
return LoginCustomNodeHelper.GetStatus(smoObject);
|
||||
}
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
get
|
||||
new NodeSmoProperty
|
||||
{
|
||||
return new List<NodeSmoProperty>
|
||||
{
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsDisabled",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
};
|
||||
Name = "IsDisabled",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
}
|
||||
|
||||
internal static class LoginCustomNodeHelper
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
@@ -14,27 +15,21 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
/// </summary>
|
||||
internal partial class TriggersChildFactory : SmoChildFactoryBase
|
||||
{
|
||||
public static readonly List<NodeSmoProperty> SmoPropertyList = new List<NodeSmoProperty>
|
||||
public static readonly Lazy<List<NodeSmoProperty>> SmoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsEnabled",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext)
|
||||
{
|
||||
return TriggersCustomeNodeHelper.GetStatus(smoObject);
|
||||
}
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
{
|
||||
get
|
||||
{
|
||||
return TriggersChildFactory.SmoPropertyList;
|
||||
}
|
||||
}
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => SmoPropertiesLazy.Value;
|
||||
}
|
||||
|
||||
internal partial class ServerLevelServerTriggersChildFactory : SmoChildFactoryBase
|
||||
@@ -48,7 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return TriggersChildFactory.SmoPropertyList;
|
||||
return TriggersChildFactory.SmoPropertiesLazy.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,7 +59,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return TriggersChildFactory.SmoPropertyList;
|
||||
return TriggersChildFactory.SmoPropertiesLazy.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
@@ -19,20 +20,16 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
return UserCustomeNodeHelper.GetStatus(smoObject);
|
||||
}
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
get
|
||||
new NodeSmoProperty
|
||||
{
|
||||
return new List<NodeSmoProperty>
|
||||
{
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "HasDBAccess",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
};
|
||||
Name = "HasDBAccess",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
}
|
||||
|
||||
internal static class UserCustomeNodeHelper
|
||||
|
||||
@@ -180,34 +180,29 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
public override IEnumerable<string> ApplicableParents() { return new[] { "Databases" }; }
|
||||
|
||||
public override IEnumerable<NodeFilter> Filters
|
||||
{
|
||||
get
|
||||
{
|
||||
var filters = new List<NodeFilter>();
|
||||
filters.Add(new NodeFilter
|
||||
{
|
||||
Property = "IsSystemObject",
|
||||
Type = typeof(bool),
|
||||
Values = new List<object> { 0 },
|
||||
});
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
private readonly Lazy<List<NodeFilter>> filtersLazy = new Lazy<List<NodeFilter>>(() => new List<NodeFilter>
|
||||
{
|
||||
get
|
||||
{
|
||||
var properties = new List<NodeSmoProperty>();
|
||||
properties.Add(new NodeSmoProperty
|
||||
{
|
||||
Name = "Status",
|
||||
ValidFor = ValidForFlag.All
|
||||
});
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
new NodeFilter
|
||||
{
|
||||
Property = "IsSystemObject",
|
||||
Type = typeof(bool),
|
||||
Values = new List<object> { 0 },
|
||||
}
|
||||
});
|
||||
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "Status",
|
||||
ValidFor = ValidForFlag.All
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeFilter> Filters => filtersLazy.Value;
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
|
||||
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
|
||||
{
|
||||
@@ -753,60 +748,54 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
public override IEnumerable<string> ApplicableParents() { return new[] { "Tables" }; }
|
||||
|
||||
public override IEnumerable<NodeFilter> Filters
|
||||
private readonly Lazy<List<NodeFilter>> filtersLazy = new Lazy<List<NodeFilter>>(() => new List<NodeFilter>
|
||||
{
|
||||
get
|
||||
{
|
||||
var filters = new List<NodeFilter>();
|
||||
filters.Add(new NodeFilter
|
||||
new NodeFilter
|
||||
{
|
||||
Property = "IsSystemObject",
|
||||
Type = typeof(bool),
|
||||
Values = new List<object> { 0 },
|
||||
},
|
||||
new NodeFilter
|
||||
{
|
||||
Property = "TemporalType",
|
||||
Type = typeof(Enum),
|
||||
ValidFor = ValidForFlag.Sql2016 | ValidForFlag.Sql2017 | ValidForFlag.AzureV12,
|
||||
Values = new List<object>
|
||||
{
|
||||
Property = "IsSystemObject",
|
||||
Type = typeof(bool),
|
||||
Values = new List<object> { 0 },
|
||||
});
|
||||
filters.Add(new NodeFilter
|
||||
{
|
||||
Property = "TemporalType",
|
||||
Type = typeof(Enum),
|
||||
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12,
|
||||
Values = new List<object>
|
||||
{
|
||||
{ TableTemporalType.None },
|
||||
{ TableTemporalType.SystemVersioned }
|
||||
}
|
||||
});
|
||||
return filters;
|
||||
}
|
||||
}
|
||||
{ TableTemporalType.None },
|
||||
{ TableTemporalType.SystemVersioned }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties
|
||||
private readonly Lazy<List<NodeSmoProperty>> smoPropertiesLazy = new Lazy<List<NodeSmoProperty>>(() => new List<NodeSmoProperty>
|
||||
{
|
||||
get
|
||||
{
|
||||
var properties = new List<NodeSmoProperty>();
|
||||
properties.Add(new NodeSmoProperty
|
||||
{
|
||||
Name = "IsFileTable",
|
||||
ValidFor = ValidForFlag.Sql2012|ValidForFlag.Sql2014|ValidForFlag.Sql2016|ValidForFlag.Sql2017
|
||||
});
|
||||
properties.Add(new NodeSmoProperty
|
||||
{
|
||||
Name = "IsSystemVersioned",
|
||||
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
||||
});
|
||||
properties.Add(new NodeSmoProperty
|
||||
{
|
||||
Name = "TemporalType",
|
||||
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
||||
});
|
||||
properties.Add(new NodeSmoProperty
|
||||
{
|
||||
Name = "IsExternal",
|
||||
ValidFor = ValidForFlag.Sql2016|ValidForFlag.Sql2017|ValidForFlag.AzureV12
|
||||
});
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsFileTable",
|
||||
ValidFor = ValidForFlag.Sql2012 | ValidForFlag.Sql2014 | ValidForFlag.Sql2016 | ValidForFlag.Sql2017
|
||||
},
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsSystemVersioned",
|
||||
ValidFor = ValidForFlag.Sql2016 | ValidForFlag.Sql2017 | ValidForFlag.AzureV12
|
||||
},
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "TemporalType",
|
||||
ValidFor = ValidForFlag.Sql2016 | ValidForFlag.Sql2017 | ValidForFlag.AzureV12
|
||||
},
|
||||
new NodeSmoProperty
|
||||
{
|
||||
Name = "IsExternal",
|
||||
ValidFor = ValidForFlag.Sql2016 | ValidForFlag.Sql2017 | ValidForFlag.AzureV12
|
||||
}
|
||||
});
|
||||
|
||||
public override IEnumerable<NodeFilter> Filters => filtersLazy.Value;
|
||||
|
||||
public override IEnumerable<NodeSmoProperty> SmoProperties => smoPropertiesLazy.Value;
|
||||
|
||||
protected override void OnExpandPopulateFolders(IList<TreeNode> currentChildren, TreeNode parent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user