Upgrade solution to .NET 6.0.9 (Build with .NET SDK v6.0.401) (#1692)

This commit is contained in:
Cheena Malhotra
2022-09-16 11:27:52 -07:00
committed by GitHub
parent 676819f669
commit 006ac60923
74 changed files with 143 additions and 414 deletions

View File

@@ -43,10 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (conditionParser == null)
{
conditionParser = new ConditionParser();
}
conditionParser ??= new ConditionParser();
return conditionParser;
}
}

View File

@@ -67,10 +67,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (cursorOperationParser == null)
{
cursorOperationParser = new CursorOperationParser();
}
cursorOperationParser ??= new CursorOperationParser();
return cursorOperationParser;
}
}

View File

@@ -19,10 +19,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
object cursorType = node["CursorActualType"];
if (cursorType == null)
{
cursorType = node["StatementType"];
}
cursorType ??= node["StatementType"];
Operation cursor = cursorType != null
? OperationTable.GetCursorType(cursorType.ToString())
@@ -46,10 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (cursorStatementParser == null)
{
cursorStatementParser = new CursorStatementParser();
}
cursorStatementParser ??= new CursorStatementParser();
return cursorStatementParser;
}
}

View File

@@ -101,10 +101,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
get
{
object propertyValue = this["EstimateRows"];
if (propertyValue == null)
{
propertyValue = this["StatementEstRows"];
}
propertyValue ??= this["StatementEstRows"];
return propertyValue != null ? Convert.ToDouble(propertyValue, CultureInfo.CurrentCulture) : 0;
}

View File

@@ -51,10 +51,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (filterTypeParser == null)
{
filterTypeParser = new FilterTypeParser();
}
filterTypeParser ??= new FilterTypeParser();
return filterTypeParser;
}
}

View File

@@ -80,10 +80,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (functionTypeParser == null)
{
functionTypeParser = new FunctionTypeParser();
}
functionTypeParser ??= new FunctionTypeParser();
return functionTypeParser;
}
}

View File

@@ -28,10 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (indexOpTypeParser == null)
{
indexOpTypeParser = new IndexOpTypeParser();
}
indexOpTypeParser ??= new IndexOpTypeParser();
return indexOpTypeParser;
}
}

View File

@@ -65,10 +65,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (mergeTypeParser == null)
{
mergeTypeParser = new MergeTypeParser();
}
mergeTypeParser ??= new MergeTypeParser();
return mergeTypeParser;
}
}

View File

@@ -36,10 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
this.LogicalOpUnlocName = null;
this.PhysicalOpUnlocName = null;
this.root = context.Graph.Root;
if (this.root == null)
{
this.root = this;
}
this.root ??= this;
this.Graph = context.Graph;
}

View File

@@ -6,7 +6,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Xml.Serialization;
namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
@@ -372,7 +374,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
if (member.Name == enumMemberName)
{
object[] attributes = member.GetCustomAttributes(typeof(System.Xml.Serialization.XmlEnumAttribute), true);
foreach (System.Xml.Serialization.XmlEnumAttribute attribute in attributes)
foreach (System.Xml.Serialization.XmlEnumAttribute attribute in attributes.Cast<XmlEnumAttribute>())
{
return attribute.Name;
}

View File

@@ -139,11 +139,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
if (this.displayName != null || this.displayNameKey != null)
{
if (this.displayName == null)
{
this.displayName = SR.Keys.GetString(this.displayNameKey);
}
this.displayName ??= SR.Keys.GetString(this.displayNameKey);
return this.displayName;
}
@@ -159,11 +155,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
if (this.description != null || this.descriptionKey != null)
{
if (this.description == null)
{
this.description = SR.Keys.GetString(this.descriptionKey);
}
this.description ??= SR.Keys.GetString(this.descriptionKey);
return this.description;
}
@@ -188,10 +180,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
this.displayNameKey = displayNameDescriptionAttribute.DisplayName;
this.descriptionKey = displayNameDescriptionAttribute.Description;
if (this.descriptionKey == null)
{
this.descriptionKey = this.displayNameKey;
}
this.descriptionKey ??= this.displayNameKey;
}
DisplayOrderAttribute displayOrderAttribute =

View File

@@ -40,9 +40,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
object value = relOpProperty.GetValue(parsedItem);
if (value != null)
{
if (value is IEnumerable)
if (value is IEnumerable enumerable)
{
foreach (object item in (IEnumerable)value)
foreach (object item in enumerable)
{
yield return item;
}
@@ -72,10 +72,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (relOpBaseTypeParser == null)
{
relOpBaseTypeParser = new RelOpBaseTypeParser();
}
relOpBaseTypeParser ??= new RelOpBaseTypeParser();
return relOpBaseTypeParser;
}
}

View File

@@ -722,10 +722,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (relOpTypeParser == null)
{
relOpTypeParser = new RelOpTypeParser();
}
relOpTypeParser ??= new RelOpTypeParser();
return relOpTypeParser;
}
}

View File

@@ -133,10 +133,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (statementParser == null)
{
statementParser = new StatementParser();
}
statementParser ??= new StatementParser();
return statementParser;
}
}

View File

@@ -56,10 +56,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
get
{
if (xmlPlanHierarchyParser == null)
{
xmlPlanHierarchyParser = new XmlPlanHierarchyParser();
}
xmlPlanHierarchyParser ??= new XmlPlanHierarchyParser();
return xmlPlanHierarchyParser;
}
}

View File

@@ -12,6 +12,7 @@ using System.Xml;
using System.Text;
using System.Xml.Serialization;
using System.Reflection;
using System.Linq;
namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
@@ -40,10 +41,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
public ShowPlanGraph[] Execute(object dataSource)
{
ShowPlanXML plan = dataSource as ShowPlanXML;
if (plan == null)
{
plan = ReadXmlShowPlan(dataSource);
}
plan ??= ReadXmlShowPlan(dataSource);
List<ShowPlanGraph> graphs = new List<ShowPlanGraph>();
int statementIndex = 0;
@@ -238,7 +236,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
ArrayList targetStatementList = new ArrayList();
foreach (BaseStmtInfoType statement in statementBlock.Items)
foreach (BaseStmtInfoType statement in statementBlock.Items.Cast<BaseStmtInfoType>())
{
targetStatementList.Add(statement);
@@ -264,7 +262,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
//add this element and its children
if (stmtThen.Statements != null && stmtThen.Statements.Items != null)
{
foreach (BaseStmtInfoType subStatement in stmtThen.Statements.Items)
foreach (BaseStmtInfoType subStatement in stmtThen.Statements.Items.Cast<BaseStmtInfoType>())
{
targetStatementList.Add(subStatement);
FlattenConditionClauses(subStatement, targetStatementList);
@@ -280,7 +278,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
//add this element and its children
if (stmtElse.Statements != null && stmtElse.Statements.Items != null)
{
foreach (BaseStmtInfoType subStatement in stmtElse.Statements.Items)
foreach (BaseStmtInfoType subStatement in stmtElse.Statements.Items.Cast<BaseStmtInfoType>())
{
targetStatementList.Add(subStatement);
FlattenConditionClauses(subStatement, targetStatementList);
@@ -302,7 +300,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
ArrayList targetStatementList = new ArrayList();
foreach (BaseStmtInfoType statement in statementBlock.Items)
foreach (BaseStmtInfoType statement in statementBlock.Items.Cast<BaseStmtInfoType>())
{
targetStatementList.Add(statement);
@@ -351,7 +349,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
// Call itself recursively.
if (functionItem.Function.Statements != null && functionItem.Function.Statements.Items != null)
{
foreach (BaseStmtInfoType functionStatement in functionItem.Function.Statements.Items)
foreach (BaseStmtInfoType functionStatement in functionItem.Function.Statements.Items.Cast<BaseStmtInfoType>())
{
ExtractFunctions(functionStatement, targetStatementList);
}
@@ -369,7 +367,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
{
if (statementBlock != null && statementBlock.Items != null)
{
foreach (BaseStmtInfoType statement in statementBlock.Items)
foreach (BaseStmtInfoType statement in statementBlock.Items.Cast<BaseStmtInfoType>())
{
yield return statement;
}
@@ -402,10 +400,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
// check Memory Optimized table.
bool memoryOptimzed = false;
XmlNode scan = rootNode.SelectSingleNode("descendant::shp:IndexScan", nsMgr);
if (scan == null)
{
scan = rootNode.SelectSingleNode("descendant::shp:TableScan", nsMgr);
}
scan ??= rootNode.SelectSingleNode("descendant::shp:TableScan", nsMgr);
if (scan != null && scan.Attributes["Storage"] != null)
{
if (0 == string.Compare(scan.Attributes["Storage"].Value, "MemoryOptimized", StringComparison.Ordinal))

View File

@@ -155,10 +155,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
/// <param name="node">Node being parsed.</param>
protected virtual void SetNodeSpecialProperties(Node node)
{
if (node.Operation == null)
{
node.Operation = GetNodeOperation(node);
}
node.Operation ??= GetNodeOperation(node);
// Retrieve Subtree cost for this node
node.SubtreeCost = GetNodeSubtreeCost(node);
@@ -242,9 +239,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ExecutionPlan.ShowPlan
continue;
}
if (value is IEnumerable)
if (value is IEnumerable enumerable)
{
foreach (object item in (IEnumerable)value)
foreach (object item in enumerable)
{
if (XmlPlanParserFactory.GetParser(item.GetType()) != null)
{