mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Minor improvements (#2250)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.Utility
|
namespace Microsoft.SqlTools.Utility
|
||||||
@@ -13,7 +13,7 @@ namespace Microsoft.SqlTools.Utility
|
|||||||
{
|
{
|
||||||
public GeneralRequestDetails()
|
public GeneralRequestDetails()
|
||||||
{
|
{
|
||||||
Options = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
|
Options = new ConcurrentDictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetOptionValue<T>(string name, T defaultValue = default(T))
|
public T GetOptionValue<T>(string name, T defaultValue = default(T))
|
||||||
@@ -96,21 +96,21 @@ namespace Microsoft.SqlTools.Utility
|
|||||||
|
|
||||||
protected void SetOptionValue<T>(string name, T value)
|
protected void SetOptionValue<T>(string name, T value)
|
||||||
{
|
{
|
||||||
Options = Options ?? new Dictionary<string, object>();
|
Options = Options ?? new ConcurrentDictionary<string, object>();
|
||||||
if (Options.ContainsKey(name))
|
if (Options.ContainsKey(name))
|
||||||
{
|
{
|
||||||
Options[name] = value;
|
Options[name] = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Options.Add(name, value);
|
Options.TryAdd(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets the options
|
/// Gets or Sets the options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, object> Options { get; set; }
|
public ConcurrentDictionary<string, object> Options { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlContext
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// default text size
|
/// default text size
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int DefaultTextSize = 2147483647;
|
private const int DefaultTextSize = int.MaxValue; // 2147483647;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// default execution timeout
|
/// default execution timeout
|
||||||
|
|||||||
@@ -394,9 +394,9 @@ SELECT '$(VAR2)'";
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Assert.True(false, $"Unexpected error consuming token : {e.Message}");
|
Assert.Fail($"Unexpected error consuming token : {e.Message}");
|
||||||
}
|
}
|
||||||
// we doesn't expect any exception or testCase failures
|
// we don't expect any exception or testCase failures
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
|||||||
{
|
{
|
||||||
if (!request.Options.ContainsKey(item.Key))
|
if (!request.Options.ContainsKey(item.Key))
|
||||||
{
|
{
|
||||||
request.Options.Add(item.Key, item.Value);
|
request.Options.TryAdd(item.Key, item.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
|
|||||||
{
|
{
|
||||||
if (!request.Options.ContainsKey(item.Key))
|
if (!request.Options.ContainsKey(item.Key))
|
||||||
{
|
{
|
||||||
request.Options.Add(item.Key, item.Value);
|
request.Options.TryAdd(item.Key, item.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,33 +289,33 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DisasterRecovery
|
|||||||
private RestoreParams CreateOptionsTestData()
|
private RestoreParams CreateOptionsTestData()
|
||||||
{
|
{
|
||||||
RestoreParams optionValues = new RestoreParams();
|
RestoreParams optionValues = new RestoreParams();
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.CloseExistingConnections, false);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.CloseExistingConnections, false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.DataFileFolder, "Data file folder");
|
optionValues.Options.TryAdd(RestoreOptionsHelper.DataFileFolder, "Data file folder");
|
||||||
optionValues.Options.Add("DbFiles", new List<DbFile>() { new DbFile("", '1', "") });
|
optionValues.Options.TryAdd("DbFiles", new List<DbFile>() { new DbFile("", '1', "") });
|
||||||
optionValues.Options.Add("DefaultDataFileFolder", "Default data file folder");
|
optionValues.Options.TryAdd("DefaultDataFileFolder", "Default data file folder");
|
||||||
optionValues.Options.Add("DefaultLogFileFolder", "Default log file folder");
|
optionValues.Options.TryAdd("DefaultLogFileFolder", "Default log file folder");
|
||||||
optionValues.Options.Add("DefaultBackupFolder", "Default backup folder");
|
optionValues.Options.TryAdd("DefaultBackupFolder", "Default backup folder");
|
||||||
optionValues.Options.Add("IsTailLogBackupPossible", true);
|
optionValues.Options.TryAdd("IsTailLogBackupPossible", true);
|
||||||
optionValues.Options.Add("IsTailLogBackupWithNoRecoveryPossible", true);
|
optionValues.Options.TryAdd("IsTailLogBackupWithNoRecoveryPossible", true);
|
||||||
optionValues.Options.Add("GetDefaultStandbyFile", "default standby file");
|
optionValues.Options.TryAdd("GetDefaultStandbyFile", "default standby file");
|
||||||
optionValues.Options.Add("GetDefaultTailLogbackupFile", "default tail log backup file");
|
optionValues.Options.TryAdd("GetDefaultTailLogbackupFile", "default tail log backup file");
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.LogFileFolder, "Log file folder");
|
optionValues.Options.TryAdd(RestoreOptionsHelper.LogFileFolder, "Log file folder");
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.RelocateDbFiles, true);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.RelocateDbFiles, true);
|
||||||
optionValues.Options.Add("TailLogBackupFile", "tail log backup file");
|
optionValues.Options.TryAdd("TailLogBackupFile", "tail log backup file");
|
||||||
optionValues.Options.Add("TailLogWithNoRecovery", false);
|
optionValues.Options.TryAdd("TailLogWithNoRecovery", false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.BackupTailLog, false);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.BackupTailLog, false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.KeepReplication, false);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.KeepReplication, false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.ReplaceDatabase, false);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.ReplaceDatabase, false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.SetRestrictedUser, false);
|
optionValues.Options.TryAdd(RestoreOptionsHelper.SetRestrictedUser, false);
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.StandbyFile, "Stand by file");
|
optionValues.Options.TryAdd(RestoreOptionsHelper.StandbyFile, "Stand by file");
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.RecoveryState, DatabaseRecoveryState.WithNoRecovery.ToString());
|
optionValues.Options.TryAdd(RestoreOptionsHelper.RecoveryState, DatabaseRecoveryState.WithNoRecovery.ToString());
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.TargetDatabaseName, "target db name");
|
optionValues.Options.TryAdd(RestoreOptionsHelper.TargetDatabaseName, "target db name");
|
||||||
optionValues.Options.Add(RestoreOptionsHelper.SourceDatabaseName, "source db name");
|
optionValues.Options.TryAdd(RestoreOptionsHelper.SourceDatabaseName, "source db name");
|
||||||
optionValues.Options.Add("CanChangeTargetDatabase", true);
|
optionValues.Options.TryAdd("CanChangeTargetDatabase", true);
|
||||||
optionValues.Options.Add("DefaultSourceDbName", "DefaultSourceDbName");
|
optionValues.Options.TryAdd("DefaultSourceDbName", "DefaultSourceDbName");
|
||||||
optionValues.Options.Add("DefaultTargetDbName", "DefaultTargetDbName");
|
optionValues.Options.TryAdd("DefaultTargetDbName", "DefaultTargetDbName");
|
||||||
optionValues.Options.Add("SourceDbNames", new List<string>());
|
optionValues.Options.TryAdd("SourceDbNames", new List<string>());
|
||||||
optionValues.Options.Add("CanDropExistingConnections", true);
|
optionValues.Options.TryAdd("CanDropExistingConnections", true);
|
||||||
return optionValues;
|
return optionValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user