mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-30 17:24:37 -05:00
Publishing SQL Core library in nuget (#2173)
* Set up CI with Azure Pipelines [skip ci] * Update publishSqlCoreProject.yml for Azure Pipelines * Update publishSqlCoreProject.yml for Azure Pipelines * Update publishSqlCoreProject.yml for Azure Pipelines * Update publishSqlCoreProject.yml for Azure Pipelines * Update publishSqlCoreProject.yml for Azure Pipelines * Updating json rpc target framework * Fixing packages to pack * fixing pattern * Fixing project pattern * adding versioning schema * fixing versioning scheme * fixing nuget package name * adding name * removing var * Fixing stuff * Fixing stuff * Fixing stuff * Fixing build name * removing build name * fixing name * fixing stuff * fix pattern * Fixing stuff * Fixing feed * Fix stuff * Fixing feed * fixing proj name * Fixing stuff * Fixing netframework version * Fixing target framework * Adding target framework to dependency * Fixing frameworks * adding net7.0 * adding flag * Fixing target frameworks and making code compatible with lang version * fixed flag * Fixing assembly name * Adding hosting in nuget package * Fixing tests * Moving steps to its main pipeline * only releasing when release is true * Fixing build scripts * Adding version to csproj for packaging * adding version * Fix dirs * Adding version number to right prop group * Adding necessary dis * Fixing build number * fixing datatype * Using different var * Removing unused yml * Adding back nullables to hosting * Adding back more nullables * adding back more nullables * moving some props to dir level * Fixing tests * Removing dup properties * Supporting different target frameworks in hosting * Removing additional setting in csproj * signing sql core dll in publish * Fixing version setting * Adding to build * Added signing and packaging flag * Fixing file pattern
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<AssemblyTitle>SqlTools SqlCore Library</AssemblyTitle>
|
||||
<Description>Provides core sql functionality for SQL server editors like Object explorer, Query Execution and Scripting</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<AssemblyName>Microsoft.SqlTools.SqlCore</AssemblyName>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" Exclude="**/obj/**/*.cs" />
|
||||
@@ -21,7 +25,7 @@
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Localization\*.resx" />
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// <summary>
|
||||
/// Has information for filtering a SMO object by properties
|
||||
/// </summary>
|
||||
public interface INodeFilter
|
||||
public abstract class INodeFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the filter can be apply to the given type and Server type
|
||||
@@ -21,15 +21,15 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// <param name="type">Type of the querier</param>
|
||||
/// <param name="validForFlag">Server Type</param>
|
||||
/// <returns></returns>
|
||||
bool CanApplyFilter(Type type, ValidForFlag validForFlag);
|
||||
public abstract bool CanApplyFilter(Type type, ValidForFlag validForFlag);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a string from the filter property and values to be used in the Urn to query the SQL objects
|
||||
/// Example of the output:[@ IsSystemObject = 0]
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string ToPropertyFilterString(Type type, ValidForFlag validForFlag);
|
||||
|
||||
public abstract string ToPropertyFilterString(Type type, ValidForFlag validForFlag);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a fully paramaterized property filter string for the URN query for SQL objects.
|
||||
/// Example of the output:[@ IsSystemObject = 0]
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// </summary>
|
||||
/// <param name="type">Type of the querier</param>
|
||||
/// <param name="validForFlag">Server Type</param>
|
||||
public bool CanApplyFilter(Type type, ValidForFlag validForFlag) {
|
||||
public override bool CanApplyFilter(Type type, ValidForFlag validForFlag) {
|
||||
return this.FilterList.Exists(f => f.CanApplyFilter(type, validForFlag));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// Example of the output: ((@TableTemporalType = 1) or (@LedgerTableType = 1))
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
|
||||
public override string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
|
||||
{
|
||||
StringBuilder filter = new StringBuilder();
|
||||
foreach (var nodeFilter in FilterList)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// <param name="type">Type of the querier</param>
|
||||
/// <param name="validForFlag">Server Type</param>
|
||||
/// <returns></returns>
|
||||
public bool CanApplyFilter(Type type, ValidForFlag validForFlag)
|
||||
public override bool CanApplyFilter(Type type, ValidForFlag validForFlag)
|
||||
{
|
||||
bool canApplyFilter = false;
|
||||
canApplyFilter = TypeToReverse == null || TypeToReverse == type;
|
||||
@@ -78,7 +78,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
/// Example of the output: (@ IsSystemObject = 0)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
|
||||
public override string ToPropertyFilterString(Type type, ValidForFlag validForFlag)
|
||||
{
|
||||
// check first if the filter can be applied; if not just return empty string
|
||||
if (!CanApplyFilter(type, validForFlag))
|
||||
@@ -186,7 +186,10 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
var escapedString = StringUtils.EscapeStringSQuote(propertyValue.ToString());
|
||||
if (this.FilterType == FilterType.STARTSWITH || this.FilterType == FilterType.ENDSWITH)
|
||||
{
|
||||
escapedString = EscapeLikeURNRegex().Replace(escapedString, "[$0]");
|
||||
// For filters that use the LIKE operator, we need to escape the following characters: %, _, [, ^
|
||||
// we do this by wrapping them in square brackets eg: [%], [_], [[], [^]
|
||||
Regex escapteSqlObjectChars = new Regex(@"%|_|\[|\^");
|
||||
escapedString = escapteSqlObjectChars.Replace(escapedString, "[$0]");
|
||||
|
||||
if (this.FilterType == FilterType.STARTSWITH)
|
||||
{
|
||||
@@ -283,11 +286,6 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// For filters that use the LIKE operator, we need to escape the following characters: %, _, [, ^
|
||||
// we do this by wrapping them in square brackets eg: [%], [_], [[], [^]
|
||||
[GeneratedRegexAttribute(@"%|_|\[|\^")]
|
||||
public static partial Regex EscapeLikeURNRegex();
|
||||
}
|
||||
|
||||
public enum FilterType
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.Nodes
|
||||
}
|
||||
}
|
||||
}
|
||||
ApplicableNodeChildFactories = new Lazy<Dictionary<string, HashSet<ChildFactory>>>(factories);
|
||||
ApplicableNodeChildFactories = new Lazy<Dictionary<string, HashSet<ChildFactory>>>(() => factories);
|
||||
}
|
||||
|
||||
public IEnumerable<ChildFactory> GetApplicableChildFactories()
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel
|
||||
{
|
||||
NodeTypeDictionary.Add(containedType, new HashSet<Node>());
|
||||
}
|
||||
NodeTypeDictionary.GetValueOrDefault(containedType).Add(node);
|
||||
HashSet<Node> nodeSet;
|
||||
NodeTypeDictionary.TryGetValue(containedType, out nodeSet);
|
||||
nodeSet.Add(node);
|
||||
}
|
||||
}
|
||||
var serverNode = TreeRoot.Nodes.FirstOrDefault(node => node.Name == "Server");
|
||||
@@ -59,7 +61,8 @@ namespace Microsoft.SqlTools.SqlCore.ObjectExplorer.SmoModel
|
||||
}
|
||||
|
||||
var returnSet = new HashSet<string>();
|
||||
var matchingNodes = NodeTypeDictionary.GetValueOrDefault(typeName);
|
||||
HashSet<Node> matchingNodes;
|
||||
NodeTypeDictionary.TryGetValue(typeName, out matchingNodes);
|
||||
if (matchingNodes == null)
|
||||
{
|
||||
return returnSet;
|
||||
|
||||
Reference in New Issue
Block a user