mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Fix create db resource strings (#348)
* Hook up SMO call into create db handler * Clean-up resource strings * Few additional code clean-ups
This commit is contained in:
@@ -11,6 +11,7 @@ using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
{
|
{
|
||||||
@@ -144,11 +145,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
out connInfo);
|
out connInfo);
|
||||||
|
|
||||||
DatabaseTaskHelper taskHelper = CreateDatabaseTaskHelper(connInfo);
|
DatabaseTaskHelper taskHelper = CreateDatabaseTaskHelper(connInfo);
|
||||||
|
DatabasePrototype prototype = taskHelper.Prototype;
|
||||||
DatabaseTaskHelper.ApplyToPrototype(databaseParams.DatabaseInfo, taskHelper.Prototype);
|
DatabaseTaskHelper.ApplyToPrototype(databaseParams.DatabaseInfo, taskHelper.Prototype);
|
||||||
|
|
||||||
response.DefaultDatabaseInfo = DatabaseTaskHelper.DatabasePrototypeToDatabaseInfo(taskHelper.Prototype);
|
Database db = prototype.ApplyChanges();
|
||||||
|
|
||||||
await requestContext.SendResult(new CreateDatabaseResponse());
|
await requestContext.SendResult(new CreateDatabaseResponse()
|
||||||
|
{
|
||||||
|
Result = true,
|
||||||
|
TaskId = 0
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -198,68 +198,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
static AzureSqlDbHelper()
|
static AzureSqlDbHelper()
|
||||||
{
|
{
|
||||||
//foreach (AzureEdition edition in Enum.GetValues(typeof (AzureEdition)))
|
|
||||||
//{
|
|
||||||
// object value;
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// value = Registry.GetValue(
|
|
||||||
// string.Format(CultureInfo.InvariantCulture, @"{0}\{1}", SSMSAzureRegKey,
|
|
||||||
// AzureServiceObjectivesRegSubKey), edition.ToString(), null);
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// //We don't really care if we can't read in an override (just fall back to default) so log and move on
|
|
||||||
// TraceContext.TraceVerbose("Exception reading service objective overrides for {0} - {1}", edition, e.Message);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (value != null)
|
|
||||||
// {
|
|
||||||
// TraceContext.TraceVerbose("Found ServiceObjective override for {0}, value is {1}", edition, value);
|
|
||||||
// //Key is in format <DefaultIndex>:<ServiceObjectiveList>
|
|
||||||
// //e.g. 2:S0,S1,S2
|
|
||||||
// //Only split into 2 parts since the service objectives could
|
|
||||||
// //be changed in the future to have :'s, so only treat the first
|
|
||||||
// //as special
|
|
||||||
// string[] values = value.ToString().Split(new[] {':'}, 2);
|
|
||||||
// if (values.Length != 2)
|
|
||||||
// {
|
|
||||||
// //Badly formatted value, ignore this one
|
|
||||||
// TraceContext.TraceVerbose("ServiceObjective override for {0} is badly formatted - skipping", edition);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// int defaultIndex;
|
|
||||||
// if (!int.TryParse(values[0], out defaultIndex))
|
|
||||||
// {
|
|
||||||
// //Invalid default index, ignore this one
|
|
||||||
// TraceContext.TraceVerbose("ServiceObjective override for {0} has non-parseable default index - skipping", edition);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Service objectives are in a comma-separated list
|
|
||||||
// string[] serviceObjectives = values[1].Split(',');
|
|
||||||
// if (defaultIndex < 0 || defaultIndex >= serviceObjectives.Length)
|
|
||||||
// {
|
|
||||||
// //Index out of bounds, ignore this one
|
|
||||||
// TraceContext.TraceVerbose("ServiceObjective override for {0} has out of bounds default index - skipping");
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// if (AzureServiceObjectiveInfo.ContainsKey(edition))
|
|
||||||
// {
|
|
||||||
// //Overwrite our default values if the registry key for this edition exists
|
|
||||||
// AzureServiceObjectiveInfo[edition] = new KeyValuePair<int, string[]>(defaultIndex,
|
|
||||||
// serviceObjectives);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// AzureServiceObjectiveInfo.Add(edition,
|
|
||||||
// new KeyValuePair<int, string[]>(defaultIndex, serviceObjectives));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2033,26 +2033,25 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
if (isAllWhitespace || (0 == fileName.Length) || (-1 != fileName.IndexOfAny(badFileCharacters)))
|
if (isAllWhitespace || (0 == fileName.Length) || (-1 != fileName.IndexOfAny(badFileCharacters)))
|
||||||
{
|
{
|
||||||
ResourceManager resourceManager =
|
ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings",
|
|
||||||
this.GetType().GetAssembly());
|
|
||||||
|
|
||||||
string message = String.Empty;
|
string message = String.Empty;
|
||||||
|
|
||||||
if (0 == fileName.Length)
|
if (0 == fileName.Length)
|
||||||
{
|
{
|
||||||
message = resourceManager.GetString("error.emptyFileName");
|
message = resourceManager.GetString("error_emptyFileName");
|
||||||
}
|
}
|
||||||
else if (isAllWhitespace)
|
else if (isAllWhitespace)
|
||||||
{
|
{
|
||||||
message = resourceManager.GetString("error.whitespaceDatabaseName");
|
message = resourceManager.GetString("error_whitespaceDatabaseName");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i = fileName.IndexOfAny(badFileCharacters);
|
int i = fileName.IndexOfAny(badFileCharacters);
|
||||||
|
|
||||||
message = String.Format(System.Globalization.CultureInfo.CurrentCulture,
|
message = String.Format(System.Globalization.CultureInfo.CurrentCulture,
|
||||||
resourceManager.GetString("error.fileNameContainsIllegalCharacter"), fileName, fileName[i]);
|
resourceManager.GetString("error_fileNameContainsIllegalCharacter"), fileName, fileName[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException(message);
|
throw new InvalidOperationException(message);
|
||||||
@@ -2119,9 +2118,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
/// <exception cref="InvalidOperationException">If logical name is empty, or physical name is invalid.</exception>
|
/// <exception cref="InvalidOperationException">If logical name is empty, or physical name is invalid.</exception>
|
||||||
private string MakeDiskFileName(string logicalName, string preferredPhysicalName, string suffix)
|
private string MakeDiskFileName(string logicalName, string preferredPhysicalName, string suffix)
|
||||||
{
|
{
|
||||||
ResourceManager resourceManager =
|
ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings",
|
|
||||||
this.GetType().GetAssembly());
|
|
||||||
|
|
||||||
string filePath = String.Empty; // returned to the caller.
|
string filePath = String.Empty; // returned to the caller.
|
||||||
if (String.IsNullOrEmpty(preferredPhysicalName))
|
if (String.IsNullOrEmpty(preferredPhysicalName))
|
||||||
@@ -2140,7 +2137,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
{
|
{
|
||||||
string message = String.Empty;
|
string message = String.Empty;
|
||||||
|
|
||||||
message = resourceManager.GetString("error.emptyFileName");
|
message = resourceManager.GetString("error_emptyFileName");
|
||||||
throw new InvalidOperationException(message);
|
throw new InvalidOperationException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2468,18 +2465,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
/// <returns>List of Restrict Access Types </returns>
|
/// <returns>List of Restrict Access Types </returns>
|
||||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||||
{
|
{
|
||||||
ResourceManager manager =
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings",
|
|
||||||
typeof (DatabasePrototype).GetAssembly());
|
|
||||||
List<string> standardValues = new List<string>();
|
List<string> standardValues = new List<string>();
|
||||||
TypeConverter.StandardValuesCollection result = null;
|
TypeConverter.StandardValuesCollection result = null;
|
||||||
|
|
||||||
if (string.Compare(context.PropertyDescriptor.Name, "RestrictAccess", StringComparison.OrdinalIgnoreCase) ==
|
if (string.Compare(context.PropertyDescriptor.Name, "RestrictAccess", StringComparison.OrdinalIgnoreCase) ==
|
||||||
0)
|
0)
|
||||||
{
|
{
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.multiple"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_multiple"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.single"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_single"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.restricted"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_restricted"));
|
||||||
}
|
}
|
||||||
if (standardValues.Count > 0)
|
if (standardValues.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -2520,17 +2515,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
string.Compare(context.PropertyDescriptor.Name, "DatabaseStatusDisplay",
|
string.Compare(context.PropertyDescriptor.Name, "DatabaseStatusDisplay",
|
||||||
StringComparison.OrdinalIgnoreCase) == 0)
|
StringComparison.OrdinalIgnoreCase) == 0)
|
||||||
{
|
{
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.normal"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_normal"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.restoring"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_restoring"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.recoveryPending"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_recoveryPending"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.recovering"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_recovering"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.suspect"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_suspect"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.offline"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_offline"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.inaccessible"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_inaccessible"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.standby"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_standby"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.shutdown"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_shutdown"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.emergency"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_emergency"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.databaseState.value.autoClosed"));
|
standardValues.Add(manager.GetString("prototype_db_prop_databaseState_value_autoClosed"));
|
||||||
}
|
}
|
||||||
if (standardValues.Count > 0)
|
if (standardValues.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -983,61 +983,61 @@ WHERE do.database_id = @DbID
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
string result = null;
|
string result = null;
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype90).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Normal) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Normal) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.normal"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Restoring) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Restoring) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.restoring"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_restoring"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.RecoveryPending) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.RecoveryPending) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.recoveryPending"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_recoveryPending"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Recovering) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Recovering) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.recovering"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_recovering"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Suspect) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Suspect) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.suspect"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_suspect"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Offline) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Offline) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.offline"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_offline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Inaccessible) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Inaccessible) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.inaccessible"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_inaccessible"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Standby) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Standby) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.standby"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_standby"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.Shutdown) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.Shutdown) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.shutdown"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_shutdown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.EmergencyMode) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.EmergencyMode) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.emergency"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_emergency"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.currentState.databaseState & DatabaseStatus.AutoClosed) != 0)
|
if ((this.currentState.databaseState & DatabaseStatus.AutoClosed) != 0)
|
||||||
{
|
{
|
||||||
result = this.AppendState(result, manager.GetString("prototype.db.prop.databaseState.value.autoClosed"));
|
result = this.AppendState(result, manager.GetString("prototype_db_prop_databaseState_value_autoClosed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -1089,19 +1089,19 @@ WHERE do.database_id = @DbID
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
switch (this.currentState.defaultCursor)
|
switch (this.currentState.defaultCursor)
|
||||||
{
|
{
|
||||||
case DefaultCursor.Local:
|
case DefaultCursor.Local:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.defaultCursor.value.local");
|
result = manager.GetString("prototype_db_prop_defaultCursor_value_local");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DefaultCursor.Global:
|
case DefaultCursor.Global:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.defaultCursor.value.global");
|
result = manager.GetString("prototype_db_prop_defaultCursor_value_global");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1110,9 +1110,9 @@ WHERE do.database_id = @DbID
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
|
|
||||||
if (value == manager.GetString("prototype.db.prop.defaultCursor.value.local"))
|
if (value == manager.GetString("prototype_db_prop_defaultCursor_value_local"))
|
||||||
{
|
{
|
||||||
this.currentState.defaultCursor = DefaultCursor.Local;
|
this.currentState.defaultCursor = DefaultCursor.Local;
|
||||||
}
|
}
|
||||||
@@ -1547,7 +1547,7 @@ WHERE do.database_id = @DbID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $FUTURE: 6/29/2004-stevetw Make sure version checks use this property,
|
// Make sure version checks use this property,
|
||||||
// not explicit comparisons against the server major version
|
// not explicit comparisons against the server major version
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the server is Yukon or later
|
/// Whether the server is Yukon or later
|
||||||
@@ -1897,9 +1897,7 @@ WHERE do.database_id = @DbID
|
|||||||
db.Alter(termination);
|
db.Alter(termination);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXED-SQLBUDefectTracking-20006074-2005/07/11-stevetw
|
|
||||||
// have to explicitly set the default filegroup after the database has been created
|
// have to explicitly set the default filegroup after the database has been created
|
||||||
// Also bug 97696
|
|
||||||
foreach (FilegroupPrototype filegroup in Filegroups)
|
foreach (FilegroupPrototype filegroup in Filegroups)
|
||||||
{
|
{
|
||||||
if (filegroup.IsDefault && !(filegroup.Exists && db.FileGroups[filegroup.Name].IsDefault))
|
if (filegroup.IsDefault && !(filegroup.Exists && db.FileGroups[filegroup.Name].IsDefault))
|
||||||
@@ -2609,19 +2607,19 @@ WHERE do.database_id = @DbID
|
|||||||
{
|
{
|
||||||
|
|
||||||
TypeConverter.StandardValuesCollection result = null;
|
TypeConverter.StandardValuesCollection result = null;
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
List<string> standardValues = new List<string>();
|
List<string> standardValues = new List<string>();
|
||||||
|
|
||||||
if (context.PropertyDescriptor.Name == "DefaultCursorDisplay")
|
if (context.PropertyDescriptor.Name == "DefaultCursorDisplay")
|
||||||
{
|
{
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.defaultCursor.value.local"));
|
standardValues.Add(manager.GetString("prototype_db_prop_defaultCursor_value_local"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.defaultCursor.value.global"));
|
standardValues.Add(manager.GetString("prototype_db_prop_defaultCursor_value_global"));
|
||||||
}
|
}
|
||||||
else if (context.PropertyDescriptor.Name == "RestrictAccess")
|
else if (context.PropertyDescriptor.Name == "RestrictAccess")
|
||||||
{
|
{
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.multiple"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_multiple"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.single"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_single"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.restrictAccess.value.restricted"));
|
standardValues.Add(manager.GetString("prototype_db_prop_restrictAccess_value_restricted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (standardValues.Count > 0)
|
if (standardValues.Count > 0)
|
||||||
@@ -253,21 +253,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
/// <returns>A string from the resource manager representing the value.</returns>
|
/// <returns>A string from the resource manager representing the value.</returns>
|
||||||
private string GetDatabaseScopedConfigDisplayText(DatabaseScopedConfigurationOnOff onOffValue)
|
private string GetDatabaseScopedConfigDisplayText(DatabaseScopedConfigurationOnOff onOffValue)
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
switch (onOffValue)
|
switch (onOffValue)
|
||||||
{
|
{
|
||||||
case DatabaseScopedConfigurationOnOff.Off:
|
case DatabaseScopedConfigurationOnOff.Off:
|
||||||
result = manager.GetString("prototype.db.prop.databasescopedconfig.value.off");
|
result = manager.GetString("prototype_db_prop_databasescopedconfig_value_off");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DatabaseScopedConfigurationOnOff.On:
|
case DatabaseScopedConfigurationOnOff.On:
|
||||||
result = manager.GetString("prototype.db.prop.databasescopedconfig.value.on");
|
result = manager.GetString("prototype_db_prop_databasescopedconfig_value_on");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DatabaseScopedConfigurationOnOff.Primary:
|
case DatabaseScopedConfigurationOnOff.Primary:
|
||||||
result = manager.GetString("prototype.db.prop.databasescopedconfig.value.primary");
|
result = manager.GetString("prototype_db_prop_databasescopedconfig_value_primary");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,13 +282,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
/// <returns>The database scoped configuration enum value that matches the display text.</returns>
|
/// <returns>The database scoped configuration enum value that matches the display text.</returns>
|
||||||
private DatabaseScopedConfigurationOnOff SetDatabaseScopedConfigHelper(string displayText, bool forSecondary)
|
private DatabaseScopedConfigurationOnOff SetDatabaseScopedConfigHelper(string displayText, bool forSecondary)
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
|
|
||||||
if (displayText == manager.GetString("prototype.db.prop.databasescopedconfig.value.off"))
|
if (displayText == manager.GetString("prototype_db_prop_databasescopedconfig_value_off"))
|
||||||
{
|
{
|
||||||
return DatabaseScopedConfigurationOnOff.Off;
|
return DatabaseScopedConfigurationOnOff.Off;
|
||||||
}
|
}
|
||||||
else if (displayText == manager.GetString("prototype.db.prop.databasescopedconfig.value.on") || !forSecondary)
|
else if (displayText == manager.GetString("prototype_db_prop_databasescopedconfig_value_on") || !forSecondary)
|
||||||
{
|
{
|
||||||
return DatabaseScopedConfigurationOnOff.On;
|
return DatabaseScopedConfigurationOnOff.On;
|
||||||
}
|
}
|
||||||
@@ -5,22 +5,17 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
//using Microsoft.SqlServer.Management.SqlMgmt;
|
|
||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlServer.Management.Diagnostics;
|
using Microsoft.SqlServer.Management.Diagnostics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
//using DisplayNameAttribute = Microsoft.SqlServer.Management.SqlMgmt.DisplayNameAttribute;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database Prototype for SqlServer 2000 and later servers
|
/// Database Prototype for SqlServer 2000 and later servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[TypeConverter(typeof(DynamicValueTypeConverter))]
|
|
||||||
//[StringResourceClass(typeof(Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR))]
|
|
||||||
internal class DatabasePrototype80 : DatabasePrototype, IDynamicValues
|
internal class DatabasePrototype80 : DatabasePrototype, IDynamicValues
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,19 +48,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype80).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
switch (this.currentState.pageVerify)
|
switch (this.currentState.pageVerify)
|
||||||
{
|
{
|
||||||
case PageVerify.Checksum:
|
case PageVerify.Checksum:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.pageVerify.value.checksum");
|
result = manager.GetString("prototype_db_prop_pageVerify_value_checksum");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PageVerify.None:
|
case PageVerify.None:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.pageVerify.value.none");
|
result = manager.GetString("prototype_db_prop_pageVerify_value_none");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PageVerify.TornPageDetection:
|
case PageVerify.TornPageDetection:
|
||||||
@@ -79,12 +74,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype80).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
if (value == manager.GetString("prototype.db.prop.pageVerify.value.checksum"))
|
if (value == manager.GetString("prototype_db_prop_pageVerify_value_checksum"))
|
||||||
{
|
{
|
||||||
this.currentState.pageVerify = PageVerify.Checksum;
|
this.currentState.pageVerify = PageVerify.Checksum;
|
||||||
}
|
}
|
||||||
else if (value == manager.GetString("prototype.db.prop.pageVerify.value.none"))
|
else if (value == manager.GetString("prototype_db_prop_pageVerify_value_none"))
|
||||||
{
|
{
|
||||||
this.currentState.pageVerify = PageVerify.None;
|
this.currentState.pageVerify = PageVerify.None;
|
||||||
}
|
}
|
||||||
@@ -198,7 +193,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
{
|
{
|
||||||
base.SaveProperties(db);
|
base.SaveProperties(db);
|
||||||
|
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
|
|
||||||
// never set the real database collation to "<server default>" - there is no
|
// never set the real database collation to "<server default>" - there is no
|
||||||
// real collation with that name. "<server default>" is only valid for new
|
// real collation with that name. "<server default>" is only valid for new
|
||||||
@@ -257,16 +252,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
if (context.PropertyDescriptor.Name == "PageVerifyDisplay")
|
if (context.PropertyDescriptor.Name == "PageVerifyDisplay")
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype80).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
List<string> standardValues = new List<string>();
|
List<string> standardValues = new List<string>();
|
||||||
|
|
||||||
if (this.IsYukonOrLater)
|
if (this.IsYukonOrLater)
|
||||||
{
|
{
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.pageVerify.value.checksum"));
|
standardValues.Add(manager.GetString("prototype_db_prop_pageVerify_value_checksum"));
|
||||||
}
|
}
|
||||||
|
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.pageVerify.value.tornPageDetection"));
|
standardValues.Add(manager.GetString("prototype_db_prop_pageVerify_value_tornPageDetection"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.pageVerify.value.none"));
|
standardValues.Add(manager.GetString("prototype_db_prop_pageVerify_value_none"));
|
||||||
|
|
||||||
result = new TypeConverter.StandardValuesCollection(standardValues);
|
result = new TypeConverter.StandardValuesCollection(standardValues);
|
||||||
}
|
}
|
||||||
@@ -4,18 +4,14 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
// using Microsoft.SqlServer.Management.SqlMgmt;
|
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
|
|
||||||
// using DisplayNameAttribute = Microsoft.SqlServer.Management.SqlMgmt.DisplayNameAttribute;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database Prototype for SqlServer 2000 SP3 and later servers
|
/// Database Prototype for SqlServer 2000 SP3 and later servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TypeConverter(typeof(DynamicValueTypeConverter))]
|
[TypeConverter(typeof(DynamicValueTypeConverter))]
|
||||||
//[StringResourceClass(typeof(Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR))]
|
|
||||||
internal class DatabasePrototype80SP3 : DatabasePrototype80
|
internal class DatabasePrototype80SP3 : DatabasePrototype80
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,5 +31,3 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
public DatabasePrototype80SP3(CDataContainer context) : base(context) { }
|
public DatabasePrototype80SP3(CDataContainer context) : base(context) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5,22 +5,17 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
// using Microsoft.SqlServer.Management.SqlMgmt;
|
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlServer.Management.Diagnostics;
|
using Microsoft.SqlServer.Management.Diagnostics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
// using DisplayNameAttribute = Microsoft.SqlServer.Management.SqlMgmt.DisplayNameAttribute;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database Prototype for SqlServer 2005 and later servers
|
/// Database Prototype for SqlServer 2005 and later servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[TypeConverter(typeof(DynamicValueTypeConverter))]
|
|
||||||
//[StringResourceClass(typeof(Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR))]
|
|
||||||
internal class DatabasePrototype90 : DatabasePrototype80SP3, IDynamicValues
|
internal class DatabasePrototype90 : DatabasePrototype80SP3, IDynamicValues
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -51,24 +46,24 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype80).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
string result = null;
|
string result = null;
|
||||||
|
|
||||||
switch (this.currentState.pageVerify)
|
switch (this.currentState.pageVerify)
|
||||||
{
|
{
|
||||||
case PageVerify.Checksum:
|
case PageVerify.Checksum:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.pageVerify.value.checksum");
|
result = manager.GetString("prototype_db_prop_pageVerify_value_checksum");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PageVerify.None:
|
case PageVerify.None:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.pageVerify.value.none");
|
result = manager.GetString("prototype_db_prop_pageVerify_value_none");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PageVerify.TornPageDetection:
|
case PageVerify.TornPageDetection:
|
||||||
|
|
||||||
result = manager.GetString("prototype.db.prop.pageVerify.value.tornPageDetection");
|
result = manager.GetString("prototype_db_prop_pageVerify_value_tornPageDetection");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,12 +72,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype80).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
if (value == manager.GetString("prototype.db.prop.pageVerify.value.checksum"))
|
if (value == manager.GetString("prototype_db_prop_pageVerify_value_checksum"))
|
||||||
{
|
{
|
||||||
this.currentState.pageVerify = PageVerify.Checksum;
|
this.currentState.pageVerify = PageVerify.Checksum;
|
||||||
}
|
}
|
||||||
else if (value == manager.GetString("prototype.db.prop.pageVerify.value.none"))
|
else if (value == manager.GetString("prototype_db_prop_pageVerify_value_none"))
|
||||||
{
|
{
|
||||||
this.currentState.pageVerify = PageVerify.None;
|
this.currentState.pageVerify = PageVerify.None;
|
||||||
}
|
}
|
||||||
@@ -192,17 +187,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype90).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
string result = this.currentState.parameterization ?
|
string result = this.currentState.parameterization ?
|
||||||
manager.GetString("prototype.db.prop.parameterization.value.forced") :
|
manager.GetString("prototype_db_prop_parameterization_value_forced") :
|
||||||
manager.GetString("prototype.db.prop.parameterization.value.simple");
|
manager.GetString("prototype_db_prop_parameterization_value_simple");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype90).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
this.currentState.parameterization = (value == manager.GetString("prototype.db.prop.parameterization.value.forced"));
|
this.currentState.parameterization = (value == manager.GetString("prototype_db_prop_parameterization_value_forced"));
|
||||||
this.NotifyObservers();
|
this.NotifyObservers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,10 +262,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
if (context.PropertyDescriptor.Name == "Parameterization")
|
if (context.PropertyDescriptor.Name == "Parameterization")
|
||||||
{
|
{
|
||||||
ResourceManager manager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabasePrototype90).GetAssembly());
|
ResourceManager manager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.Localization.SR", typeof(DatabasePrototype).GetAssembly());
|
||||||
List<string> standardValues = new List<string>();
|
List<string> standardValues = new List<string>();
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.parameterization.value.forced"));
|
standardValues.Add(manager.GetString("prototype_db_prop_parameterization_value_forced"));
|
||||||
standardValues.Add(manager.GetString("prototype.db.prop.parameterization.value.simple"));
|
standardValues.Add(manager.GetString("prototype_db_prop_parameterization_value_simple"));
|
||||||
result = new TypeConverter.StandardValuesCollection(standardValues);
|
result = new TypeConverter.StandardValuesCollection(standardValues);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -4,19 +4,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
// using Microsoft.SqlServer.Management.SqlMgmt;
|
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
|
|
||||||
// using DisplayNameAttribute = Microsoft.SqlServer.Management.SqlMgmt.DisplayNameAttribute;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database Prototype for SqlServer 2005 Enterprise SP2 and later servers
|
/// Database Prototype for SqlServer 2005 Enterprise SP2 and later servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TypeConverter(typeof(DynamicValueTypeConverter))]
|
[TypeConverter(typeof(DynamicValueTypeConverter))]
|
||||||
//[StringResourceClass(typeof(Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR))]
|
|
||||||
internal class DatabasePrototype90EnterpriseSP2 : DatabasePrototype90
|
internal class DatabasePrototype90EnterpriseSP2 : DatabasePrototype90
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -155,11 +155,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int logicalNameCount = 0;
|
||||||
|
|
||||||
public static DatabasePrototype ApplyToPrototype(DatabaseInfo databaseInfo, DatabasePrototype prototype)
|
public static DatabasePrototype ApplyToPrototype(DatabaseInfo databaseInfo, DatabasePrototype prototype)
|
||||||
{
|
{
|
||||||
if (databaseInfo != null && prototype != null)
|
if (databaseInfo != null && prototype != null)
|
||||||
{
|
{
|
||||||
prototype.Name = GetValueOrDefault(AdminServicesProviderOptionsHelper.Name, databaseInfo.Options, prototype.Name);
|
prototype.Name = GetValueOrDefault(AdminServicesProviderOptionsHelper.Name, databaseInfo.Options, prototype.Name);
|
||||||
|
|
||||||
|
foreach (var file in prototype.Files)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(file.Name))
|
||||||
|
{
|
||||||
|
file.Name = prototype.Name + "_" + logicalNameCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return prototype;
|
return prototype;
|
||||||
}
|
}
|
||||||
@@ -117,9 +117,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
|
|||||||
filePath = fileUri.LocalPath.TrimStart('/');
|
filePath = fileUri.LocalPath.TrimStart('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some clients send paths with UNIX-style slashes, replace those if necessary
|
|
||||||
filePath = filePath.Replace('/', '\\');
|
|
||||||
|
|
||||||
// Clients could specify paths with escaped space, [ and ] characters which .NET APIs
|
// Clients could specify paths with escaped space, [ and ] characters which .NET APIs
|
||||||
// will not handle. These paths will get appropriately escaped just before being passed
|
// will not handle. These paths will get appropriately escaped just before being passed
|
||||||
// into the SqlTools engine.
|
// into the SqlTools engine.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Moq;
|
|||||||
using Microsoft.SqlTools.Hosting.Protocol;
|
using Microsoft.SqlTools.Hosting.Protocol;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Admin.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Admin.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
||||||
{
|
{
|
||||||
@@ -43,17 +44,20 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Validate creating a database with valid input
|
/// Validate creating a database with valid input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// [Fact]
|
[Fact]
|
||||||
public async void CreateDatabaseWithValidInputTest()
|
public async void CreateDatabaseWithValidInputTest()
|
||||||
{
|
{
|
||||||
var result = GetLiveAutoCompleteTestObjects();
|
var result = GetLiveAutoCompleteTestObjects();
|
||||||
var requestContext = new Mock<RequestContext<CreateDatabaseResponse>>();
|
var requestContext = new Mock<RequestContext<CreateDatabaseResponse>>();
|
||||||
requestContext.Setup(x => x.SendResult(It.IsAny<CreateDatabaseResponse>())).Returns(Task.FromResult(new object()));
|
requestContext.Setup(x => x.SendResult(It.IsAny<CreateDatabaseResponse>())).Returns(Task.FromResult(new object()));
|
||||||
|
|
||||||
|
var databaseInfo = new DatabaseInfo();
|
||||||
|
databaseInfo.Options.Add("name", "testdb_" + new Random().Next(10000000, 99999999));
|
||||||
|
|
||||||
var dbParams = new CreateDatabaseParams
|
var dbParams = new CreateDatabaseParams
|
||||||
{
|
{
|
||||||
OwnerUri = result.ConnectionInfo.OwnerUri,
|
OwnerUri = result.ConnectionInfo.OwnerUri,
|
||||||
DatabaseInfo = new DatabaseInfo()
|
DatabaseInfo = databaseInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
await AdminService.HandleCreateDatabaseRequest(dbParams, requestContext.Object);
|
await AdminService.HandleCreateDatabaseRequest(dbParams, requestContext.Object);
|
||||||
@@ -61,11 +65,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices
|
|||||||
requestContext.VerifyAll();
|
requestContext.VerifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a default database info object
|
/// Get a default database info object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// [Fact]
|
[Fact]
|
||||||
public async void GetDefaultDatebaseInfoTest()
|
public async void GetDefaultDatebaseInfoTest()
|
||||||
{
|
{
|
||||||
var result = GetLiveAutoCompleteTestObjects();
|
var result = GetLiveAutoCompleteTestObjects();
|
||||||
|
|||||||
@@ -11,6 +11,26 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class to handle loading test configuration settings
|
||||||
|
///
|
||||||
|
/// Example contents of file at default location ~/sqlConnectionSettings.json
|
||||||
|
///
|
||||||
|
/// {
|
||||||
|
/// "mssql.connections": [
|
||||||
|
/// {
|
||||||
|
/// "server": "localhost",
|
||||||
|
/// "database": "master",
|
||||||
|
/// "authenticationType": "SqlLogin",
|
||||||
|
/// "user": "sa",
|
||||||
|
/// "password": "[putvaluehere]",
|
||||||
|
/// "serverType":"OnPrem",
|
||||||
|
/// "VersionKey": "defaultSql2016"
|
||||||
|
/// }
|
||||||
|
/// ]
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public sealed class TestConfigPersistenceHelper
|
public sealed class TestConfigPersistenceHelper
|
||||||
{
|
{
|
||||||
private static string DefaultSettingFileName = Path.Combine(FileUtils.UserRootFolder, "sqlConnectionSettings.json");
|
private static string DefaultSettingFileName = Path.Combine(FileUtils.UserRootFolder, "sqlConnectionSettings.json");
|
||||||
|
|||||||
Reference in New Issue
Block a user