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

@@ -101,11 +101,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
{
get
{
if (m_hashTable == null)
{
m_hashTable = new Hashtable();
}
m_hashTable ??= new Hashtable();
return m_hashTable;
}
}
@@ -808,11 +804,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
throw new InvalidOperationException();
}
if (m_server == null)
{
// NOTE: ServerConnection property will constuct the object if needed
m_server = new Server(ServerConnection);
}
// NOTE: ServerConnection property will constuct the object if needed
m_server ??= new Server(ServerConnection);
}
else if (this.serverType == ServerType.SQLCE)
{
@@ -933,10 +926,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
public string GetDocumentPropertyString(string propertyName)
{
object result = GetDocumentPropertyValue(propertyName);
if (result == null)
{
result = string.Empty;
}
result ??= string.Empty;
return (string)result;
}
@@ -1203,10 +1193,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
bool databaseExists = false,
XmlDocument containerDoc = null)
{
if (containerDoc == null)
{
containerDoc = CreateDataContainerDocument(connInfo, databaseExists);
}
containerDoc ??= CreateDataContainerDocument(connInfo, databaseExists);
var serverConnection = ConnectionService.OpenServerConnection(connInfo, "DataContainer");

View File

@@ -95,24 +95,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
this.connection = (SqlOlapConnectionInfoBase)cloneable.Clone();
this.closeOnDispose = true;
}
else if (sourceConnection is SqlConnectionInfoWithConnection)
else if (sourceConnection is SqlConnectionInfoWithConnection connection2)
{
this.connection = ((SqlConnectionInfoWithConnection)sourceConnection).Copy();
this.connection = connection2.Copy();
this.closeOnDispose = true;
}
}
}
// if everything else has failed just use to passed in connection.
if (this.connection == null)
{
this.connection = sourceConnection;
}
this.connection ??= sourceConnection;
// always set the lock timeout to prevent the shell from not responding
if (this.connection is SqlConnectionInfoWithConnection)
if (this.connection is SqlConnectionInfoWithConnection connection1)
{
// set lock_timeout to 10 seconds
((SqlConnectionInfoWithConnection)this.connection).ServerConnection.LockTimeout = 10;
connection1.ServerConnection.LockTimeout = 10;
}
}
#endregion
@@ -190,10 +187,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
{
get
{
if (activeConnections == null)
{
activeConnections = new Hashtable();
}
activeConnections ??= new Hashtable();
return activeConnections;
}
}

View File

@@ -94,19 +94,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
}
// allow to be sited only once
if (this.serviceProvider == null)
{
// cache the service provider
this.serviceProvider = sp;
// cache the service provider
this.serviceProvider ??= sp;
// call protected virtual method to enable derived classes to do initialization
// OnHosted();
}
// call protected virtual method to enable derived classes to do initialization
// OnHosted();
}
#endregion
#endregion
#region IExecutionAwareManagementAction implementation
#region IExecutionAwareManagementAction implementation
/// <summary>
/// called before management action executes onRun method.
@@ -502,10 +499,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
{
get
{
if (this.cachedExecutionHandlerDelegate == null)
{
this.cachedExecutionHandlerDelegate = new ExecutionHandlerDelegate(this);
}
this.cachedExecutionHandlerDelegate ??= new ExecutionHandlerDelegate(this);
return this.cachedExecutionHandlerDelegate;
}
}

View File

@@ -32,11 +32,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
{
//first, see if the object implemented this interface to override standard behavior
System.Reflection.ICustomAttributeProvider attribProvider = objectToGetAttributeFrom as System.Reflection.ICustomAttributeProvider;
if (attribProvider == null)
{
//if not, get it from its type
attribProvider = (System.Reflection.ICustomAttributeProvider)objectToGetAttributeFrom.GetType();
}
//if not, get it from its type
attribProvider ??= (System.Reflection.ICustomAttributeProvider)objectToGetAttributeFrom.GetType();
object[] attribs = attribProvider.GetCustomAttributes(customAttribute, true);
if (attribs != null && attribs.Length > 0)