diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/AdminService.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/AdminService.cs index 58aacf4f..673cde00 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/AdminService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/AdminService.cs @@ -88,8 +88,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } } - var taskHelper = new DatabaseTaskHelper(); - taskHelper.CreateDatabase(dataContainer); + var taskHelper = new DatabaseTaskHelper(dataContainer); return taskHelper; } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/AzureSqlDbHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/AzureSqlDbHelper.cs index 66dc9447..d51d9cfe 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/AzureSqlDbHelper.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/AzureSqlDbHelper.cs @@ -16,14 +16,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin { public static class AzureSqlDbHelper { - private static readonly TraceContext TraceContext = TraceContext.GetTraceContext("AzureSqlDbUtils", typeof(AzureSqlDbHelper).Name); - /// - /// Registry key for SSMS Azure overrides - /// - private static readonly string SSMSAzureRegKey = - @"HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\14.0\Azure"; /// /// Registry sub key for the AzureServiceObjectives overrides diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/BrowseFolderHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/BrowseFolderHelper.cs new file mode 100644 index 00000000..dcbc797e --- /dev/null +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/BrowseFolderHelper.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Data; +using System.Text.RegularExpressions; +using Microsoft.SqlServer.Management.Sdk.Sfc; +using Microsoft.SqlServer.Management.Smo; +using Microsoft.SqlServer.Management.Common; +using Microsoft.SqlServer.Management.Diagnostics; +using Microsoft.Data.Tools.DataSets; + +namespace Microsoft.SqlTools.ServiceLayer.Admin +{ + /// + /// Helper static class for the BrowseFolder dialog + /// + internal static class BrowseFolderHelper + { + /// + /// Get the initial directory for the browse folder dialog + /// + /// The connection to the server + /// + public static string GetBrowseStartPath(ServerConnection serverConnection) + { + string result = String.Empty; + + // if (US.Current.SSMS.TaskForms.ServerFileSystem.LastPath.TryGetValue(serverConnection.TrueName, out result)) + // { + // return result; + // } + + if ((result == null) || (result.Length == 0)) + { + // try and fetch the default location from SMO... + Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(serverConnection); + result = server.Settings.DefaultFile; + + if ((result == null) || (result.Length == 0)) + { + // if the default file property doesn't return a string, + // use the location of the model database's data file. + Enumerator enumerator = new Enumerator(); + Request request = new Request(); + request.Urn = "Server/Database[@Name='model']/FileGroup[@Name='PRIMARY']/File"; + request.Fields = new string[1] {"FileName"}; + DataSet dataSet = enumerator.Process(serverConnection, request); + + if (0 < dataSet.Tables[0].Rows.Count) + { + string path = dataSet.Tables[0].Rows[0][0].ToString(); + result = PathWrapper.GetDirectoryName(path); + } + } + } + + return result; + } + } + + /// + /// Static class with Utility functions dealing with filenames + /// + internal static class FileNameHelper + { + /// + /// Checks whether a filename has invalid characters + /// + /// filename to check + /// true if filename has only valid characters + internal static bool IsValidFilename(string testName) + { + bool isValid = false; + if (!string.IsNullOrEmpty(testName)) + { + Regex containsBadCharacter = new Regex("[" + Regex.Escape(new String(Path.GetInvalidFileNameChars())) + "]"); + isValid = !containsBadCharacter.IsMatch(testName); + } + return isValid; + } + } +} diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CUtils.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CUtils.cs index 88dafa49..d056cf32 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CUtils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CUtils.cs @@ -7,18 +7,12 @@ using Microsoft.SqlServer.Management.Sdk.Sfc; using System; using System.Text; using System.Xml; -//using System.Drawing; -//using System.Windows.Forms; using System.Threading; using System.IO; -//using Microsoft.NetEnterpriseServers; -//using Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer; using Microsoft.SqlServer.Management.Common; using SMO = Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Diagnostics; -//using Microsoft.SqlServer.Management.SqlMgmt; using System.Data.SqlClient; -// using System.Management; using System.Collections; namespace Microsoft.SqlTools.ServiceLayer.Admin @@ -39,113 +33,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin // } - - //public Bitmap LoadBitmap(string szBitmapName) - //{ - // Bitmap bmp = null; - // Stream s = null; - // string strQualifiedName; - - // strQualifiedName = typeof(CUtils).Namespace + ".Images." + szBitmapName; - - // s = typeof(CUtils).Assembly.GetManifestResourceStream(strQualifiedName); - - // if (s != null) - // { - // bmp = new Bitmap(s); - // return bmp; - // } - - // return null; - //} - - //public Icon LoadIcon(string strName) - //{ - - // Icon ico = null; - // Stream s = null; - // string strQualifiedName; - - // strQualifiedName = typeof(CUtils).Namespace + ".Images." + strName; - - // s = typeof(CUtils).Assembly.GetManifestResourceStream(strQualifiedName); - - // if (s != null) - // { - // int iconSize = DpiUtil.GetScaledImageSize(); - // ico = new Icon(s, iconSize, iconSize); - // return ico; - // } - - // return null; - //} - - //public void LoadAddIcon(ImageList imageList, string strName) - //{ - // Icon ico = null; - // Stream s = null; - // string strQualifiedName; - - // strQualifiedName = typeof(CUtils).Namespace + ".Images." + strName; - - // s = typeof(CUtils).Module.Assembly.GetManifestResourceStream(strQualifiedName); - - // if (s != null) - // { - // try - // { - // ico = new Icon(s, 16, 16); - // imageList.Images.Add(ico); - // } - // finally - // { - // if (ico != null) - // ico.Dispose(); - // } - // } - //} - public static void UseMaster(SMO.Server server) { server.ConnectionContext.ExecuteNonQuery("use master"); } - - ///// - ///// returns height of my border (depending on its style) - ///// - //public static int GetBorderHeight(BorderStyle style) - //{ - // if (style == BorderStyle.FixedSingle) - // { - // return SystemInformation.BorderSize.Height; - // } - // else if (style == BorderStyle.Fixed3D) - // { - // return SystemInformation.Border3DSize.Height; - // } - // else - // { - // return 0; - // } - //} - - //public static int GetBorderWidth(BorderStyle style) - //{ - // if (style == BorderStyle.FixedSingle) - // { - // return SystemInformation.BorderSize.Width; - // } - // else if (style == BorderStyle.Fixed3D) - // { - // return SystemInformation.Border3DSize.Width; - // } - // else - // { - // return 0; - // } - //} - /// /// Get a SMO Server object that is connected to the connection /// @@ -185,74 +77,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } - public static int GetServerVersion(SMO.Server server) { return server.Information.Version.Major; } - /// - /// validates current value of given numeric control. Shows message if the value is not valid - /// - /// - /// - /// true if control's value is valid, false otherwise - //public static bool ValidateNumeric(NumericUpDown numControl, string errMessageToShow, bool displayException) - //{ - // try - // { - // int curValue = int.Parse(numControl.Text, System.Globalization.CultureInfo.CurrentCulture); - // if (curValue < numControl.Minimum || curValue > numControl.Maximum) - // { - // if (true == displayException) - // { - // ExceptionMessageBox box = new ExceptionMessageBox(); - - // box.Caption = SRError.SQLWorkbench; - // box.Message = new Exception(errMessageToShow); - // box.Symbol = ExceptionMessageBoxSymbol.Error; - // box.Buttons = ExceptionMessageBoxButtons.OK; - // box.Options = ExceptionMessageBoxOptions.RightAlign; - // box.Show(null); - // } - - // try - // { - // numControl.Value = Convert.ToDecimal(numControl.Tag, System.Globalization.CultureInfo.CurrentCulture); - // numControl.Update(); - // numControl.Text = Convert.ToString(numControl.Value, System.Globalization.CultureInfo.CurrentCulture); - // numControl.Refresh(); - - // } - // catch - // { - - // } - // numControl.Focus(); - // return false; - // } - - // return true; - // } - // catch - // { - // if (true == displayException) - // { - // ExceptionMessageBox box = new ExceptionMessageBox(); - - // box.Caption = SRError.SQLWorkbench; - // box.Message = new Exception(errMessageToShow); - // box.Symbol = ExceptionMessageBoxSymbol.Error; - // box.Buttons = ExceptionMessageBoxButtons.OK; - // box.Options = ExceptionMessageBoxOptions.RightAlign; - // box.Show(null); - // } - - // numControl.Focus(); - // return false; - // } - //} - /// /// Determines the oldest date based on the type of time units and the number of time units /// @@ -485,60 +314,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin return CUtils.UnEscapeString(s, '\''); } - /// - /// Helper method to convert DMTF format to DateTime from WMI property value - /// ManagementDateTimeConverter.ToDateTime() does not adjust time to UTC offset, - /// hence additional step to adjust datetime. - /// - /// - /// - //public static DateTime GetDateTimeFromDMTFTime(string dateTimeInDMTFFormat) - //{ - // string[] dateTimeInfo = dateTimeInDMTFFormat.Split(new char[] { '+', '-' }); - // DateTime dateTime = ManagementDateTimeConverter.ToDateTime(dateTimeInDMTFFormat); - - // TimeSpan timeSpan = TimeSpan.FromMinutes(Convert.ToDouble(dateTimeInfo[1])); - // if (dateTimeInDMTFFormat.Contains("+")) - // { - // dateTime = dateTime - timeSpan; - // } - // else - // { - // dateTime = dateTime + timeSpan; - // } - // return dateTime; - //} - - /// - /// Helper method to sort ManagementObjectCollection based ArchiveNumber property - /// - /// - /// - //public static ArrayList Sort(ManagementObjectCollection collection) - //{ - - // ArrayList array = new ArrayList(); - // array.AddRange(collection); - // ArchiveNoComparer comparer = new ArchiveNoComparer(); - // array.Sort(comparer); - // return array; - //} - - /// - /// Helper function to execute WQL - /// - /// - /// - /// - //public static ManagementObjectCollection ExecuteWQL(WmiSqlMgmtConnectionInfo wmiCi, string wql) - //{ - // ObjectQuery qry = new ObjectQuery(wql); - // ManagementScope scope = new ManagementScope(wmiCi.Namespace, wmiCi.ConnectionOptions); - // scope.Connect(); - // ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, qry); - // return searcher.Get(); - //} - /// /// Get the windows login name with the domain portion in all-caps /// @@ -564,77 +339,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin return result; } - - /// - /// Launches object picker and gets the user selected login - /// - /// - /// - /// - /// Returns null in case Object picker doesn't returns any loginName - //public static string GetWindowsLoginNameFromObjectPicker(object sender, - // Smo.Server server, - // string errorMsgToShowForTooManyLogins) - //{ - // string loginName = null; - - // ObjectPickerWrapper.TargetMachine = server.Information.NetName; - // ObjectPickerWrapper.SingleObjectSelection = true; - - // ObjectPickerWrapper.GetUsersList(sender); - - // int userCount = ObjectPickerWrapper.UsersList.Count; - - // // if the user selected one NT login, set the edit control text to the selected login - // if (1 == userCount) - // { - // loginName = ObjectPickerWrapper.UsersList[0].ToString(); - - // if (loginName.Length != 0) - // { - // loginName = CanonicalizeWindowsLoginName(loginName); - // } - // } - // // if the user selected more than one login, display an error - // else if (1 < userCount) - // { - // SqlManagementUserControl sm = sender as SqlManagementUserControl; - // if (sm != null) - // { - // sm.DisplayExceptionMessage(new Exception(errorMsgToShowForTooManyLogins)); - // } - // else - // { - // throw new InvalidOperationException(errorMsgToShowForTooManyLogins); - // } - // } - - // return loginName; - //} - - /// - /// Determines how a feature should behave (e.g. enabled or disabled) for a SQL instance's SKU/edition. - /// - /// A SMO Server object connected to a local or remote SQL instance - /// The setting to check (one of the feature constants used in settings.dat) - /// The value of the setting (e.g. SqlbootConst.SKU_YES, SqlbootConst.VALUE_UNLIMITED, etc) - //public static uint QueryRemoteSqlProductValue(ServerConnection serverConnection, uint setting) - //{ - // if (serverConnection == null) - // { - // throw new ArgumentNullException("serverConnection"); - // } - - // // The instance could be remote, so we use GetSettingValueForSKUAbsolute because it allows us to - // // query the client-side SQLBOOT.DLL to ask what the setting's value would be for the server's SKU. - // // (Most other SQLBOOT APIs can only be used for locally-installed instances.) - // // First we must retrieve the server's edition ID (SKU ID). - // int editionId = (int)serverConnection.ExecuteScalar("SELECT SERVERPROPERTY('EditionId') AS EditionId"); - - // // Then ask SQLBOOT what the setting's value should be for that SKU. - // uint value = Sqlboot.GetSettingValueForSKUAbsolute(setting, unchecked((uint)editionId)); - // return value; - //} } /// @@ -648,30 +352,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin Year } - /// - /// class to sort files based on archivenumber - /// - //internal class ArchiveNoComparer : IComparer - //{ - // public int Compare(Object x, Object y) - // { - // ManagementObject lhs = x as ManagementObject; - // ManagementObject rhs = y as ManagementObject; - - // if (null == lhs || null == rhs) - // { - // throw new ArgumentException("Object is not of type ManagementObject"); - // } - - // UInt32 l = Convert.ToUInt32(lhs.Properties["archivenumber"].Value); - // UInt32 r = Convert.ToUInt32(rhs.Properties["archivenumber"].Value); - - // int retVal = l.CompareTo(r); - - // return retVal; - // } - //} - /// /// Object used to populate default language in /// database and user dialogs. @@ -707,11 +387,3 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } } } - - - - - - - - diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CreateDatabaseData.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CreateDatabaseData.cs index ada8199a..7dc1e5b4 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CreateDatabaseData.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/CreateDatabaseData.cs @@ -1787,7 +1787,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin defaultDataFileSize = DatabaseFilePrototype.RoundUpToNearestMegabyte(size); } - catch (Exception ex) + catch (Exception) { // user doesn't have access to model so we set the default size // to be 5 MB @@ -1805,7 +1805,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin defaultLogFileSize = DatabaseFilePrototype.RoundUpToNearestMegabyte(size); } - catch (Exception ex) + catch (Exception) { // user doesn't have access to model so we set the default size // to be 1MB @@ -1864,7 +1864,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin rest); } } - catch (Exception ex) + catch (Exception) { } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DataContainer.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DataContainer.cs index 721af3f9..455b5d20 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DataContainer.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DataContainer.cs @@ -7,25 +7,18 @@ using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; -//using System.Data; -// using System.Drawing; using System.Globalization; using System.IO; using System.Reflection; using System.Security; using System.Xml; -// using Microsoft.AnalysisServices; -// using Microsoft.SqlServer.Common; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Diagnostics; using Microsoft.SqlServer.Management.Sdk.Sfc; using Microsoft.SqlServer.Management.Smo; -// using Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer; using Assembly = System.Reflection.Assembly; using System.Xml.Linq; using Microsoft.Data.Tools.DataSets; -//This is used only for non-express sku - namespace Microsoft.SqlTools.ServiceLayer.Admin { @@ -49,13 +42,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin #region Fields private ServerConnection serverConnection; - private Server m_server = null; - - //This member is used for non-express sku only - // private AnalysisServices.Server m_amoServer = null; - private ISandboxLoader sandboxLoader; - - //protected XDocument m_doc = null; + private Server m_server = null; protected XmlDocument m_doc = null; private XmlDocument originalDocument = null; private SqlOlapConnectionInfoBase connectionInfo = null; @@ -128,7 +115,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } } - /// /// gets/sets SMO server object /// @@ -144,26 +130,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } } - /// - /// gets/sets AMO server object - /// This member is used for non-express sku only - /// - //public AnalysisServices.Server OlapServer - //{ - // get - // { - // return m_amoServer; - // } - // set - // { - // m_amoServer = value; - // } - //} - - public ISandboxLoader SandboxLoader - { - get { return this.sandboxLoader; } - } /// /// connection info that should be used by the dialogs @@ -1032,99 +998,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin #region Private helpers - /// - /// Get the font size specified in the STParameters structure - /// - /// The structure from which to extract font data - //private float GetFontSize(STParameters param) - //{ - // float result = 8.0f; - // string fontSize = String.Empty; - - // if (param.GetParam("fontsize", ref fontSize) && (0 != fontSize.Length)) - // { - // result = Convert.ToSingle(fontSize, CultureInfo.InvariantCulture); - // } - - // return result; - //} - - /// - /// Get the font style specified in the STParameters structure - /// - /// The structure from which to extract font data - //private FontStyle GetFontStyle(STParameters param) - //{ - // FontStyle style = FontStyle.Regular; - // string fontStyle = String.Empty; - - // if (param.GetParam("fontstyle", ref fontStyle) && (0 != fontStyle.Length)) - // { - // bool styleIsInitialized = false; - // string fontStyleUpper = fontStyle.ToUpperInvariant(); - - // if (-1 != fontStyleUpper.IndexOf("BOLD",StringComparison.Ordinal)) - // { - // style = FontStyle.Bold; - // styleIsInitialized = true; - // } - - // if (-1 != fontStyleUpper.IndexOf("ITALIC",StringComparison.Ordinal)) - // { - // if (styleIsInitialized) - // { - // style |= FontStyle.Italic; - // } - // else - // { - // style = FontStyle.Italic; - // styleIsInitialized = true; - // } - // } - - // if (-1 != fontStyleUpper.IndexOf("REGULAR",StringComparison.Ordinal)) - // { - // if (styleIsInitialized) - // { - // style |= FontStyle.Regular; - // } - // else - // { - // style = FontStyle.Regular; - // styleIsInitialized = true; - // } - // } - - // if (-1 != fontStyleUpper.IndexOf("STRIKEOUT",StringComparison.Ordinal)) - // { - // if (styleIsInitialized) - // { - // style |= FontStyle.Strikeout; - // } - // else - // { - // style = FontStyle.Strikeout; - // styleIsInitialized = true; - // } - // } - - // if (-1 != fontStyleUpper.IndexOf("UNDERLINE",StringComparison.Ordinal)) - // { - // if (styleIsInitialized) - // { - // style |= FontStyle.Underline; - // } - // else - // { - // style = FontStyle.Underline; - // styleIsInitialized = true; - // } - // } - // } - - // return style; - //} - /// /// Get the name and schema (if applicable) for the object we are referring to /// @@ -1209,29 +1082,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin this.sqlCiWithConnection.ConnectionClosed += new EventHandler(OnSqlConnectionClosed); } } - - ///// - ///// returns string that should be specified to AMO Server.Connect method - ///// This member is used for non-express sku only - ///// - ///// - //internal string OlapConnectionString - //{ - // get - // { - // OlapConnectionInfo olapCi = this.ConnectionInfo as OlapConnectionInfo; - // if (olapCi != null) - // { - // return olapCi.ConnectionString; - // } - // else - // { - // STrace.Assert(this.olapServerName != null); - // return string.Format(CultureInfo.InvariantCulture, "Data Source={0}", this.olapServerName); - // } - - // } - //} private static bool MustRethrow(Exception exception) { @@ -1294,848 +1144,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin #endregion - #region ICustomTypeDescriptor - - //AttributeCollection ICustomTypeDescriptor.GetAttributes() - //{ - // return AttributeCollection.Empty; - //} - - //string ICustomTypeDescriptor.GetClassName() - //{ - // return TypeDescriptor.GetClassName(this, true); - //} - - //string ICustomTypeDescriptor.GetComponentName() - //{ - // return TypeDescriptor.GetComponentName(this, true); - //} - - //TypeConverter ICustomTypeDescriptor.GetConverter() - //{ - // return TypeDescriptor.GetConverter(GetType()); - //} - - //EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() - //{ - // return TypeDescriptor.GetDefaultEvent(GetType()); - //} - - //PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() - //{ - // return TypeDescriptor.GetDefaultProperty(GetType()); - //} - - //object ICustomTypeDescriptor.GetEditor(Type editorBaseType) - //{ - // return TypeDescriptor.GetEditor(GetType(), editorBaseType); - //} - - //EventDescriptorCollection ICustomTypeDescriptor.GetEvents() - //{ - // return EventDescriptorCollection.Empty; - //} - - //EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) - //{ - // return EventDescriptorCollection.Empty; - //} - - //PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() - //{ - // return PropertyDescriptorCollection.Empty; - //} - - //PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) - //{ - // PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null); - - // if (this.serverType == ServerType.SQL) - // { - // bool serverIsAvailable = false; - // int queryTimeout = 30; - - // try - // { - // // five seconds should be plenty to determine the network name of the server - // queryTimeout = this.m_server.ConnectionContext.StatementTimeout; - // this.m_server.ConnectionContext.StatementTimeout = 5; - // serverIsAvailable = this.m_server.Information.NetName != null; - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - // } - // finally - // { - // this.m_server.ConnectionContext.StatementTimeout = queryTimeout; - // } - - // PropertyDescriptor propertyDescriptor; - // /////////////////////////////ServerEnvironment//////////////////////////////// - // // Computer Name - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.Information.NetName : SR.ServerIsUnavailable, - // SR.ComputerName, - // SR.ServerEnvironment, - // SR.ComputerNameDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.ComputerName, - // SR.ServerEnvironment, - // SR.ComputerNameDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Platform - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // ((this.m_server.Information.Platform == null) ? - // String.Empty : - // this.m_server.Information.Platform) : - // SR.ServerIsUnavailable, - // SR.Platform, - // SR.ServerEnvironment, - // SR.PlatformDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Platform, - // SR.ServerEnvironment, - // SR.PlatformDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Operating System - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.Information.OSVersion : SR.ServerIsUnavailable, - // SR.OperatingSystem, - // SR.ServerEnvironment, - // SR.OperatingSystemDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.OperatingSystem, - // SR.ServerEnvironment, - // SR.OperatingSystemDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Processors - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.Information.Processors.ToString() : - // SR.ServerIsUnavailable, - // SR.Processors, - // SR.ServerEnvironment, - // SR.ProcessorsDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Processors, - // SR.ServerEnvironment, - // SR.ProcessorsDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Operating System Memory - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.Information.PhysicalMemory.ToString() : - // SR.ServerIsUnavailable, - // SR.OperatingSystemMemory, - // SR.ServerEnvironment, - // SR.OperatingSystemMemoryDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.OperatingSystemMemory, - // SR.ServerEnvironment, - // SR.OperatingSystemMemoryDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // /////////////////////////////ProductCategory//////////////////////////////// - // // Product Name - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // (this.m_server.Information.Product + " " + this.m_server.Information.Edition) : - // SR.ServerIsUnavailable, - // SR.ProductName, - // SR.ProductCategory, - // SR.ProductNameDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.ProductName, - // SR.ProductCategory, - // SR.ProductNameDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Product Version - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // (this.m_server.Information.Version + " " + this.m_server.Information.ProductLevel) : - // SR.ServerIsUnavailable, - // SR.ProductVersion, - // SR.ProductCategory, - // SR.ProductVersionDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.ProductVersion, - // SR.ProductCategory, - // SR.ProductVersionDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Server Name - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.Name : SR.ServerIsUnavailable, - // SR.ServerName, - // SR.ProductCategory, - // SR.ServerNameDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.ServerName, - // SR.ProductCategory, - // SR.ServerNameDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Instance Name - // try - // { - // string instanceName = serverIsAvailable ? this.m_server.InstanceName : SR.ServerIsUnavailable; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (instanceName != null) ? instanceName : String.Empty, - // SR.InstanceName, - // SR.ProductCategory, - // SR.InstanceNameDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.InstanceName, - // SR.ProductCategory, - // SR.InstanceNameDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Language - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.Information.Language : SR.ServerIsUnavailable, - // SR.Language, - // SR.ProductCategory, - // SR.LanguageDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Language, - // SR.ProductCategory, - // SR.LanguageDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Collation - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.Information.Collation : SR.ServerIsUnavailable, - // SR.Collation, - // SR.ProductCategory, - // SR.CollationDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Collation, - // SR.ProductCategory, - // SR.CollationDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // /////////////////////////////ConnectionCategory//////////////////////////////// - // // Database - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.ConnectionContext.SqlConnectionObject.Database : - // SR.ServerIsUnavailable, - // SR.Database, - // SR.ConnectionCategory, - // SR.DatabaseDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Database, - // SR.ConnectionCategory, - // SR.DatabaseDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // SPID - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.ConnectionContext.ProcessID.ToString() : - // SR.ServerIsUnavailable, - // SR.Spid, - // SR.ConnectionCategory, - // SR.SpidDescription); - // } - // catch (InvalidCastException) - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // String.Empty, - // SR.Spid, - // SR.ConnectionCategory, - // SR.SpidDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.Spid, - // SR.ConnectionCategory, - // SR.SpidDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Network Protocol - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // (this.m_server.ConnectionContext.NetworkProtocol == NetworkProtocol.NotSpecified ? - // SR.Default : - // this.m_server.ConnectionContext.NetworkProtocol.ToString()) : - // SR.ServerIsUnavailable, - // SR.NetworkProtocol, - // SR.ConnectionCategory, - // SR.NetworkProtocolDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.NetworkProtocol, - // SR.ConnectionCategory, - // SR.NetworkProtocolDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Network Packet Size - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.ConnectionContext.PacketSize.ToString() : - // SR.ServerIsUnavailable, - // SR.NetworkPacketSize, - // SR.ConnectionCategory, - // SR.NetworkPacketSizeDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.NetworkPacketSize, - // SR.ConnectionCategory, - // SR.NetworkPacketSizeDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Connect Timeout - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.ConnectionContext.ConnectTimeout.ToString() : - // SR.ServerIsUnavailable, - // SR.ConnectTimeout, - // SR.ConnectionCategory, - // SR.ConnectTimeoutDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.ConnectTimeout, - // SR.ConnectionCategory, - // SR.ConnectTimeoutDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Statement Timeout - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? - // this.m_server.ConnectionContext.StatementTimeout.ToString() : - // SR.ServerIsUnavailable, - // SR.StatementTimeout, - // SR.ConnectionCategory, - // SR.StatementTimeoutDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.StatementTimeout, - // SR.ConnectionCategory, - // SR.StatementTimeoutDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Encryption - // try - // { - // string encryptAsString = SR.NoString; - - // if (serverIsAvailable) - // { - // if (this.m_server.ConnectionContext.EncryptConnection) - // { - // encryptAsString = SR.YesString; - // } - // } - // else - // { - // encryptAsString = SR.ServerIsUnavailable; - // } - - // propertyDescriptor = new PropertyDescriptorWrapper( - // encryptAsString, - // SR.EncryptedConnection, - // SR.ConnectionCategory, - // SR.EncryptedConnectionDescription); - // } - // catch (InvalidCastException) - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // String.Empty, - // SR.EncryptedConnection, - // SR.ConnectionCategory, - // SR.EncryptedConnectionDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.EncryptedConnection, - // SR.ConnectionCategory, - // SR.EncryptedConnectionDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // /////////////////////////////Authentication//////////////////////////////// - // // Authentication - // try - // { - // string authenticationType; - - // if (!serverIsAvailable) - // { - // authenticationType = SR.ServerIsUnavailable; - // } - // else if (this.m_server.ConnectionContext.LoginSecure) - // { - // authenticationType = SR.WindowsAuthentication; - // } - // else - // { - // authenticationType = SR.SqlServerAuthentication; - // } - - // propertyDescriptor = new PropertyDescriptorWrapper( - // authenticationType, - // SR.AuthenticationMethod, - // SR.AuthenticationCategory, - // SR.AuthenticationMethodDescription); - - // } - // catch (PropertyNotAvailableException e) - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message == null) ? String.Empty : e.Message, - // SR.AuthenticationMethod, - // SR.AuthenticationCategory, - // SR.AuthenticationMethodDescription); - - // } - // catch (Exception exception) - // { - // if (MustRethrow(exception)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (exception.Message != null) ? exception.Message : SR.ServerIsUnavailable, - // SR.EncryptedConnection, - // SR.ConnectionCategory, - // SR.EncryptedConnectionDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // TrueLogin - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper( - // serverIsAvailable ? this.m_server.ConnectionContext.TrueLogin : SR.ServerIsUnavailable, - // SR.UserName, - // SR.AuthenticationCategory, - // SR.UserNameDescription); - // } - // catch (Exception e) - // { - // if (MustRethrow(e)) - // { - // throw; - // } - - // serverIsAvailable = false; - - // propertyDescriptor = new PropertyDescriptorWrapper( - // (e.Message != null) ? e.Message : SR.ServerIsUnavailable, - // SR.UserName, - // SR.AuthenticationCategory, - // SR.UserNameDescription); - // } - - // propertyDescriptorCollection.Add(propertyDescriptor); - // } - // else if (!Utils.IsSsmsMinimalSet()) - // { - // if (this.serverType == ServerType.OLAP) - // { - // PropertyDescriptor propertyDescriptor; - - // /////////////////////////////ServerEnvironment//////////////////////////////// - - // /////////////////////////////ProductCategory//////////////////////////////// - // // Product Version - // propertyDescriptor = new PropertyDescriptorWrapper(this.m_amoServer.Version, SR.ProductVersion, SR.ProductCategory, SR.ProductVersionDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // // Server Name - // propertyDescriptor = new PropertyDescriptorWrapper(this.m_amoServer.Name, SR.ServerName, SR.ProductCategory, SR.ServerNameDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // // Language - // int langAsInt = Convert.ToInt32(this.m_amoServer.ServerProperties[@"Language"].Value, CultureInfo.InvariantCulture); - // if (langAsInt > 0) - // { - // try - // { - // propertyDescriptor = new PropertyDescriptorWrapper(new CultureInfo(langAsInt).ToString(), SR.Language, SR.ProductCategory, SR.LanguageDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // } - // catch //eat it - CultureInfo might not be creatable from this ID - // { } - // } - // // Collation - // propertyDescriptor = new PropertyDescriptorWrapper(this.m_amoServer.ServerProperties[@"CollationName"].Value, SR.Collation, SR.ProductCategory, SR.CollationDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // /////////////////////////////ConnectionCategory//////////////////////////////// - // // Database - // propertyDescriptor = new PropertyDescriptorWrapper(this.ConnectionInfo.DatabaseName, SR.Database, SR.ConnectionCategory, SR.DatabaseDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // // Connect Timeout - // propertyDescriptor = new PropertyDescriptorWrapper(this.ConnectionInfo.ConnectionTimeout, SR.ConnectTimeout, SR.ConnectionCategory, SR.ConnectTimeoutDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // // Execution Timeout - // propertyDescriptor = new PropertyDescriptorWrapper(this.ConnectionInfo.QueryTimeout, SR.StatementTimeout, SR.ConnectionCategory, SR.StatementTimeoutDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // //whether connection is encrypted or not - // OlapConnectionInfo olapCi = this.ConnectionInfo as OlapConnectionInfo; - // if (olapCi != null) - // { - // string encryptAsString = SR.NoString; - // if (olapCi.EncryptConnection) - // { - // encryptAsString = SR.YesString; - // } - // propertyDescriptor = new PropertyDescriptorWrapper(encryptAsString, SR.EncryptedConnection, SR.ConnectionCategory, SR.EncryptedConnectionDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // } - - // // Authentication - // if (this.ConnectionInfo.UseIntegratedSecurity) - // propertyDescriptor = new PropertyDescriptorWrapper(SR.WindowsAuthentication, SR.AuthenticationMethod, SR.AuthenticationCategory, SR.AuthenticationMethodDescription); - // else - // propertyDescriptor = new PropertyDescriptorWrapper(SR.SqlServerAuthentication, SR.AuthenticationMethod, SR.AuthenticationCategory, SR.AuthenticationMethodDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // // TrueLogin - // propertyDescriptor = new PropertyDescriptorWrapper(this.ConnectionInfo.UserName, SR.UserName, SR.AuthenticationCategory, SR.UserNameDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - // } - // else if (this.serverType == ServerType.SQLCE) - // { - // PropertyDescriptor propertyDescriptor; - - // // Create an instance of SQLCE engine through reflection - // // - // Assembly asm = SfcUtility.LoadSqlCeAssembly( - // "Microsoft.SqlServerCe.Client.dll"); - // Type type = asm.GetType("Microsoft.SqlServerCe.Client.SqlCeEngine", true); - - // // Create SqlCeEngine instance - // // - // ConstructorInfo constructor = type.GetConstructor(new Type[] { }); - // object instance = constructor.Invoke(new object[] { }); - - // // Call GetDatabaseProperties - // // - // Type[] types = { typeof(String) }; - // MethodInfo mi = type.GetMethod("GetDatabaseProperties", types); - - // instance = mi.Invoke(instance, new object[] { SqlCeFileName }); - - // // Call the accessors on the DatabaseProperties class - // // - // type = asm.GetType("Microsoft.SqlServerCe.Client.DatabaseProperties", true); - - // PropertyInfo pi = type.GetProperty("Platform"); - // string platform = (string)pi.GetValue(instance, new object[] { }); - - // pi = type.GetProperty("OSVersion"); - // string osVersion = (string)pi.GetValue(instance, new object[] { }); - - // pi = type.GetProperty("Version"); - // string sqlCeVersion = (string)pi.GetValue(instance, new object[] { }); - - // pi = type.GetProperty("ClrVersion"); - // string clrVersion = (string)pi.GetValue(instance, new object[] { }); - - // // Platform - // propertyDescriptor = new PropertyDescriptorWrapper(platform, SR.Platform, SR.ServerEnvironment, SR.PlatformDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Operating System - // propertyDescriptor = new PropertyDescriptorWrapper(osVersion, SR.OperatingSystem, SR.ServerEnvironment, SR.OperatingSystemDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // CLR version - // propertyDescriptor = new PropertyDescriptorWrapper(clrVersion, SR.ClrVersion, SR.ServerEnvironment, SR.ClrVersionDescription); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Product Name - // propertyDescriptor = new PropertyDescriptorWrapper(SR.SqlServerCeName, SR.ProductName, SR.ProductCategory, SR.ProductNameDescriptionCE); - // propertyDescriptorCollection.Add(propertyDescriptor); - - // // Product Version - // propertyDescriptor = new PropertyDescriptorWrapper(sqlCeVersion, SR.ProductVersion, SR.ProductCategory, SR.ProductVersionDescriptionCE); - // propertyDescriptorCollection.Add(propertyDescriptor); - // } - // } - // return propertyDescriptorCollection; - //} - - //object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) - //{ - // return this; - //} - - #endregion - #region IDisposable public void Dispose() @@ -2193,7 +1201,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin this.managedConnection = null; } } - catch (Exception exToEat) + catch (Exception) { } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabasePrototype.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabasePrototype.cs index a5f2cc97..963a6b12 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabasePrototype.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabasePrototype.cs @@ -7,20 +7,14 @@ using System; using System.Collections.Specialized; using System.ComponentModel; using System.Resources; -// using System.Data; -//using System.Windows.Forms; -//using Microsoft.SqlServer.Management.AzureSqlDbUtils; using Microsoft.SqlServer.Management.Common; -//using Microsoft.SqlServer.Management.SqlMgmt; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Sdk.Sfc; using Microsoft.SqlServer.Management.Diagnostics; -//using Microsoft.NetEnterpriseServers; using System.Globalization; using System.Data.SqlClient; using System.Collections.Generic; using System.Diagnostics; -//using DisplayNameAttribute = Microsoft.SqlServer.Management.SqlMgmt.DisplayNameAttribute; using AzureEdition = Microsoft.SqlTools.ServiceLayer.Admin.AzureSqlDbHelper.AzureEdition; using Microsoft.Data.Tools.DataSets; @@ -1767,235 +1761,235 @@ WHERE do.database_id = @DbID /// /// The control through which UI interactions are to be marshalled /// The SMO database object that was created or modified - //public virtual Database ApplyChanges(Control marshallingControl) - //{ - // Database db = null; + public virtual Database ApplyChanges() + { + Database db = null; - // if (this.ChangesExist()) - // { - // bool scripting = (SqlExecutionModes.CaptureSql == this.context.Server.ConnectionContext.SqlExecutionModes); - // bool mustRollback = false; + if (this.ChangesExist()) + { + bool scripting = (SqlExecutionModes.CaptureSql == this.context.Server.ConnectionContext.SqlExecutionModes); + bool mustRollback = false; - // db = this.GetDatabase(); + db = this.GetDatabase(); - // // Other connections will need to be closed if the following is true - // // 1) The database already exists, AND - // // 2) We are not scripting, AND - // // a) read-only state is changing, OR - // // b) user-access is changing, OR - // // c) date correlation optimization is changing + // Other connections will need to be closed if the following is true + // 1) The database already exists, AND + // 2) We are not scripting, AND + // a) read-only state is changing, OR + // b) user-access is changing, OR + // c) date correlation optimization is changing - // // There are also additional properties we don't currently expose that also need - // // to be changed when no one else is connected: + // There are also additional properties we don't currently expose that also need + // to be changed when no one else is connected: - // // d) emergency, OR - // // e) offline, (moving to offline - obviously not necessary to check when moving from offline) - // // f) read committed snapshot + // d) emergency, OR + // e) offline, (moving to offline - obviously not necessary to check when moving from offline) + // f) read committed snapshot - // if (this.Exists && !scripting && - // ((this.currentState.isReadOnly != this.originalState.isReadOnly) || - // (this.currentState.filestreamDirectoryName != this.originalState.filestreamDirectoryName) || - // (this.currentState.filestreamNonTransactedAccess != this.originalState.filestreamNonTransactedAccess) || - // (this.currentState.restrictAccess != this.originalState.restrictAccess) || - // (this.currentState.dateCorrelationOptimization != this.originalState.dateCorrelationOptimization) || - // (this.currentState.isReadCommittedSnapshotOn != this.originalState.isReadCommittedSnapshotOn))) - // { + if (this.Exists && !scripting && + ((this.currentState.isReadOnly != this.originalState.isReadOnly) || + (this.currentState.filestreamDirectoryName != this.originalState.filestreamDirectoryName) || + (this.currentState.filestreamNonTransactedAccess != this.originalState.filestreamNonTransactedAccess) || + (this.currentState.restrictAccess != this.originalState.restrictAccess) || + (this.currentState.dateCorrelationOptimization != this.originalState.dateCorrelationOptimization) || + (this.currentState.isReadCommittedSnapshotOn != this.originalState.isReadCommittedSnapshotOn))) + { - // // If the user lacks permissions to enumerate other connections (e.g. the user is not SA) - // // assume there is a connection to close. This occasionally results in unnecessary - // // prompts, but the database alter does succeed this way. If we assume no other connections, - // // then we get errors when other connections do exist. - // int numberOfOpenConnections = 1; + // If the user lacks permissions to enumerate other connections (e.g. the user is not SA) + // assume there is a connection to close. This occasionally results in unnecessary + // prompts, but the database alter does succeed this way. If we assume no other connections, + // then we get errors when other connections do exist. + int numberOfOpenConnections = 1; - // try - // { - // numberOfOpenConnections = db.ActiveConnections; - // } - // catch (Exception ex) - // { - // // do nothing - the user doesn't have permission to check whether there are active connections - // STrace.LogExCatch(ex); - // } + try + { + numberOfOpenConnections = db.ActiveConnections; + } + catch (Exception) + { + // do nothing - the user doesn't have permission to check whether there are active connections + //STrace.LogExCatch(ex); + } - // if (0 < numberOfOpenConnections) - // { - // DialogResult result = (DialogResult)marshallingControl.Invoke(new SimplePrompt(this.PromptToCloseConnections)); - // if (result == DialogResult.No) - // { - // throw new OperationCanceledException(); - // } + if (0 < numberOfOpenConnections) + { + // DialogResult result = (DialogResult)marshallingControl.Invoke(new SimplePrompt(this.PromptToCloseConnections)); + // if (result == DialogResult.No) + // { + // throw new OperationCanceledException(); + // } + mustRollback = true; + throw new OperationCanceledException(); + } + } - // mustRollback = true; - // } - // } + // create/alter filegroups + foreach (FilegroupPrototype filegroup in Filegroups) + { + filegroup.ApplyChanges(db); + } - // // create/alter filegroups - // foreach (FilegroupPrototype filegroup in Filegroups) - // { - // filegroup.ApplyChanges(db); - // } + // create/alter files + foreach (DatabaseFilePrototype file in Files) + { + file.ApplyChanges(db); + } - // // create/alter files - // foreach (DatabaseFilePrototype file in Files) - // { - // file.ApplyChanges(db); - // } + // set the database properties + this.SaveProperties(db); - // // set the database properties - // this.SaveProperties(db); - - // // alter the database to match the properties - // if (!this.Exists) - // { - // // this is to prevent silent creation of db behind users back - // // eg. the alter statements to set properties fail when filestream directory name is invalid bug #635273 - // // but create database statement already succeeded + // alter the database to match the properties + if (!this.Exists) + { + // this is to prevent silent creation of db behind users back + // eg. the alter statements to set properties fail when filestream directory name is invalid bug #635273 + // but create database statement already succeeded - // // if filestream directory name has been set by user validate it - // if (!string.IsNullOrEmpty(this.FilestreamDirectoryName)) - // { - // // check is filestream directory name is valid - // if (!FileNameHelper.IsValidFilename(this.FilestreamDirectoryName)) - // { - // string message = String.Format(System.Globalization.CultureInfo.InvariantCulture, - // Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR.Error_InvalidDirectoryName, - // this.FilestreamDirectoryName); - // throw new ArgumentException(message); - // } + // if filestream directory name has been set by user validate it + if (!string.IsNullOrEmpty(this.FilestreamDirectoryName)) + { + // check is filestream directory name is valid + if (!FileNameHelper.IsValidFilename(this.FilestreamDirectoryName)) + { + string message = String.Format(System.Globalization.CultureInfo.InvariantCulture, + "CreateDatabaseOptionsSR.Error_InvalidDirectoryName {0}", + this.FilestreamDirectoryName); + throw new ArgumentException(message); + } - // int rowCount = 0; - // try - // { + int rowCount = 0; + try + { - // //if filestream directory name already exists in this instance - // string sqlFilestreamQuery = string.Format(SmoApplication.DefaultCulture, "SELECT * from sys.database_filestream_options WHERE directory_name = {0}", - // SqlSmoObject.MakeSqlString(this.FilestreamDirectoryName)); - // DataSet filestreamResults = this.context.ServerConnection.ExecuteWithResults(sqlFilestreamQuery); - // rowCount = filestreamResults.Tables[0].Rows.Count; - // } - // catch - // { - // // lets not do anything if there is an exception while validating - // // this is will prevent bugs in validation logic from preventing creation of valid databases - // // if database settings are invalid create database tsql statement will fail anyways - // } - // if (rowCount != 0) - // { - // string message = String.Format(System.Globalization.CultureInfo.InvariantCulture, - // Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseOptionsSR.Error_ExistingDirectoryName, - // this.FilestreamDirectoryName, this.Name); - // throw new ArgumentException(message); + //if filestream directory name already exists in this instance + string sqlFilestreamQuery = string.Format(System.Globalization.CultureInfo.InvariantCulture, + "SELECT * from sys.database_filestream_options WHERE directory_name = {0}", + SqlSmoObject.MakeSqlString(this.FilestreamDirectoryName)); + DataSet filestreamResults = this.context.ServerConnection.ExecuteWithResults(sqlFilestreamQuery); + rowCount = filestreamResults.Tables[0].Rows.Count; + } + catch + { + // lets not do anything if there is an exception while validating + // this is will prevent bugs in validation logic from preventing creation of valid databases + // if database settings are invalid create database tsql statement will fail anyways + } + if (rowCount != 0) + { + string message = String.Format(System.Globalization.CultureInfo.InvariantCulture, + "CreateDatabaseOptionsSR.Error_ExistingDirectoryName {0} {1}", + this.FilestreamDirectoryName, this.Name); + throw new ArgumentException(message); - // } - // } + } + } - // db.Create(); - // } - // else - // { - // TerminationClause termination = - // mustRollback ? - // TerminationClause.RollbackTransactionsImmediately : - // TerminationClause.FailOnOpenTransactions; + db.Create(); + } + else + { + TerminationClause termination = + mustRollback ? + TerminationClause.RollbackTransactionsImmediately : + TerminationClause.FailOnOpenTransactions; - // 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 - // // Also bug 97696 - // foreach (FilegroupPrototype filegroup in Filegroups) - // { - // if (filegroup.IsDefault && !(filegroup.Exists && db.FileGroups[filegroup.Name].IsDefault)) - // { - // if ((filegroup.IsFileStream || filegroup.IsMemoryOptimized) && - // Utils.IsKatmaiOrLater(db.ServerVersion.Major)) - // { - // db.SetDefaultFileStreamFileGroup(filegroup.Name); - // } - // else - // { - // db.SetDefaultFileGroup(filegroup.Name); - // } - // } - // } + // FIXED-SQLBUDefectTracking-20006074-2005/07/11-stevetw + // have to explicitly set the default filegroup after the database has been created + // Also bug 97696 + foreach (FilegroupPrototype filegroup in Filegroups) + { + if (filegroup.IsDefault && !(filegroup.Exists && db.FileGroups[filegroup.Name].IsDefault)) + { + if ((filegroup.IsFileStream || filegroup.IsMemoryOptimized)) + { + db.SetDefaultFileStreamFileGroup(filegroup.Name); + } + else + { + db.SetDefaultFileGroup(filegroup.Name); + } + } + } - // FilegroupPrototype fg = null; - // // drop should happen after alter so that if we delete default filegroup it makes another default before deleting. - // // drop removed files and filegroups for existing databases - // if (this.Exists) - // { - // foreach (FilegroupPrototype filegroup in this.removedFilegroups) - // { - // // In case all filegroups are removed from filestream . memory optimized one default will remain and that has to be the last. - // if ((filegroup.IsFileStream || filegroup.IsMemoryOptimized) && - // db.FileGroups[filegroup.Name].IsDefault) - // { - // fg = filegroup; - // } - // else - // { - // filegroup.ApplyChanges(db); - // } - // } + FilegroupPrototype fg = null; + // drop should happen after alter so that if we delete default filegroup it makes another default before deleting. + // drop removed files and filegroups for existing databases + if (this.Exists) + { + foreach (FilegroupPrototype filegroup in this.removedFilegroups) + { + // In case all filegroups are removed from filestream . memory optimized one default will remain and that has to be the last. + if ((filegroup.IsFileStream || filegroup.IsMemoryOptimized) && + db.FileGroups[filegroup.Name].IsDefault) + { + fg = filegroup; + } + else + { + filegroup.ApplyChanges(db); + } + } - // if (fg != null) - // { - // fg.ApplyChanges(db); - // } + if (fg != null) + { + fg.ApplyChanges(db); + } - // foreach (DatabaseFilePrototype file in this.removedFiles) - // { - // file.ApplyChanges(db); - // } - // } + foreach (DatabaseFilePrototype file in this.removedFiles) + { + file.ApplyChanges(db); + } + } - // // SnapshotIsolation and Owner cannot be set during scripting time for a newly creating database - // // and even in capture mode. Hence this check has been made - // if (db.State == SqlSmoState.Existing) - // { - // if (this.originalState.allowSnapshotIsolation != this.currentState.allowSnapshotIsolation) - // { - // db.SetSnapshotIsolation(this.currentState.allowSnapshotIsolation); - // } + // SnapshotIsolation and Owner cannot be set during scripting time for a newly creating database + // and even in capture mode. Hence this check has been made + if (db.State == SqlSmoState.Existing) + { + if (this.originalState.allowSnapshotIsolation != this.currentState.allowSnapshotIsolation) + { + db.SetSnapshotIsolation(this.currentState.allowSnapshotIsolation); + } - // // Set the database owner. Note that setting owner is an "immediate" operation that - // // has to happen after the database is created. There is a SMO limitation where SMO - // // throws an exception if immediate operations such as SetOwner() are attempted on - // // an object that doesn't exist on the server. + // Set the database owner. Note that setting owner is an "immediate" operation that + // has to happen after the database is created. There is a SMO limitation where SMO + // throws an exception if immediate operations such as SetOwner() are attempted on + // an object that doesn't exist on the server. - // if ((this.Owner.Length != 0) && - // (this.currentState.owner != this.originalState.owner)) - // { - // // - // // bug 20000092 says the error message is confusing if this fails, so - // // wrap this and throw a nicer error on failure. - // // - // try - // { - // db.SetOwner(this.Owner, false); - // } - // catch (Exception ex) - // { - // SqlException sqlException = CUtils.GetSqlException(ex); + if ((this.Owner.Length != 0) && + (this.currentState.owner != this.originalState.owner)) + { + // + // bug 20000092 says the error message is confusing if this fails, so + // wrap this and throw a nicer error on failure. + // + try + { + db.SetOwner(this.Owner, false); + } + catch (Exception ex) + { + SqlException sqlException = CUtils.GetSqlException(ex); - // if ((null != sqlException) && CUtils.IsPermissionDeniedException(sqlException)) - // { - // STrace.LogExCatch(ex); - // throw new Exception(SRError.SetOwnerFailed(this.Owner), ex); - // } - // else - // { - // throw; - // } - // } - // } - // } - // } + if ((null != sqlException) && CUtils.IsPermissionDeniedException(sqlException)) + { + + throw new Exception("SRError.SetOwnerFailed(this.Owner)" + ex.ToString()); + } + else + { + throw; + } + } + } + } + } - // return db; - //} + return db; + } /// /// Purge Query Store Data. @@ -2163,20 +2157,6 @@ WHERE do.database_id = @DbID } Database database = context.Server.Databases[this.Name]; - - // we can only get the files and filegroups if the db can be opened. - // dbs that are in a restoring state, for example, can't be asked for this info. - //if (!DBPropSheet.IsAccessible(database)) - //{ - // return; - //} - - // Dialog load time optimization: tell SMO to initialize all Filegroups and all Files - // using one single query (instead of 1/query for each File collection in each Filegroup) - - // database.InitChildLevel("FileGroup", null, false); - // database.InitChildLevel("FileGroup/File", null, false); - foreach (FileGroup filegroup in database.FileGroups) { FilegroupPrototype filegroupPrototype = new FilegroupPrototype(this, @@ -2196,7 +2176,7 @@ WHERE do.database_id = @DbID this.Add(file); } } - catch (ExecutionFailureException ex) + catch (ExecutionFailureException) { // do nothing @@ -2239,7 +2219,7 @@ WHERE do.database_id = @DbID this.Add(logfilePrototype); } } - catch (ExecutionFailureException ex) + catch (ExecutionFailureException) { // do nothing } @@ -2572,26 +2552,6 @@ WHERE do.database_id = @DbID return result; } - // private delegate DialogResult SimplePrompt(); - - /// - /// Show prompt dialog to close other open connections - /// - /// The prompt result - //private DialogResult PromptToCloseConnections() - //{ - // ResourceManager resourceManager = new ResourceManager("Microsoft.SqlServer.Management.SqlManagerUI.CreateDatabaseStrings", typeof(DatabaseAlreadyExistsException).Assembly); - // ExceptionMessageBox emb = new ExceptionMessageBox(); - // emb.Buttons = ExceptionMessageBoxButtons.YesNo; - // emb.Symbol = ExceptionMessageBoxSymbol.Question; - // emb.Caption = resourceManager.GetString("title.openConnectionsMustBeClosed"); - // emb.Message = new Exception(resourceManager.GetString("warning.openConnectionsMustBeClosed")); - // DialogResult result = emb.Show(null); - - // return result; - //} - - protected Database GetDatabase() { Database result = null; @@ -2675,5 +2635,3 @@ WHERE do.database_id = @DbID #endregion } } - - diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabaseTaskHelper.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabaseTaskHelper.cs index 7c6b8f3d..8114dc9f 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabaseTaskHelper.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/DatabaseTaskHelper.cs @@ -38,12 +38,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin } } - public void CreateDatabase(CDataContainer context) + public DatabaseTaskHelper(CDataContainer context) { - InitializeDataMembers(context); + Initialize(context); } - private void InitializeDataMembers(CDataContainer context) + internal void Initialize(CDataContainer context) { if (context != null) { @@ -88,16 +88,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin this.prototype = new DatabasePrototype(context); } - this.prototype.Initialize(); - - //this.databasesCreated = new ArrayList(); + this.prototype.Initialize(); } else { this.DataContainer = null; this.document = null; this.prototype = null; - //this.databasesCreated = null; } } @@ -149,9 +146,21 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin return databaseInfo; } + private static T GetValueOrDefault(string key, Dictionary map, T defaultValue) + { + if (map != null && map.ContainsKey(key)) + { + return map[key] != null ? (T)map[key] : default(T); + } + return defaultValue; + } + public static DatabasePrototype ApplyToPrototype(DatabaseInfo databaseInfo, DatabasePrototype prototype) { - prototype.Name = databaseInfo.Options[AdminServicesProviderOptionsHelper.Name] as string; + if (databaseInfo != null && prototype != null) + { + prototype.Name = GetValueOrDefault(AdminServicesProviderOptionsHelper.Name, databaseInfo.Options, prototype.Name); + } return prototype; } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/Utils.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/Utils.cs index bb79c39e..845dd052 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/Utils.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/Utils.cs @@ -243,93 +243,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin return result; } - /// - /// This function returns true if SSMS is the running application - /// and if it contains only the core relational packages. - /// - /// - //public static bool IsSsmsMinimalSet() - //{ - // IVsShell vsShell = Package.GetGlobalService(typeof(SVsShell)) as IVsShell; - // const string guidSqlStudioPkgString = "04401ff3-8b0f-4d2d-85eb-2a3542867a8b"; - // Guid guidSqlStudioPkg = new Guid(guidSqlStudioPkgString); - - - // //Applications like 'AS Migration wizard' are non-ssms/non-VS shell applications - // if (vsShell == null) - // { - // return false; - // } - // else - // { - // IVsPackage ssmsPackage; - // vsShell.IsPackageLoaded(ref guidSqlStudioPkg, out ssmsPackage); - - // return ((ssmsPackage != null) && - // !AreExtendedFeaturesAvailable()); - // } - //} - - /// - /// This function checks if extended SSMS packages are loaded - /// - /// - /// - //public static bool AreExtendedFeaturesAvailable() - //{ - // return Microsoft.SqlServer.Management.UI.VSIntegration.SsmsInformation.CanShowNonExpressFeatures; - //} - - /// - /// Execute a static method by reflection - /// - /// The short name of the assembly, like Microsoft.SqlServer.Management.RegisteredServersUI.dll - /// The fully qualified name of the class, like Microsoft.SqlServer.Management.RegisteredServers.Utils - /// THe name of the static method to call, like DoSomething - /// params array of arguments to pass to the method - /// - //public static object ReflectionExecuteStatic( - // string assemblyShortName, - // string className, - // string methodName, - // params object[] parameters) - //{ - // STrace.Params( - // SqlMgmtDiag.TName, - // "Utils.ReflectionExecuteStatic(string, string, string, object[])", - // "assemblyShortName='{0}', className='{1}', methodName='{2}'", - // assemblyShortName, - // className, - // methodName); - - // Assembly assembly = Assembly.Load( - // Microsoft.SqlServer.Management.SqlMgmt.AssemblyLoadUtil.GetFullAssemblyName(assemblyShortName)); - - // if (assembly == null) - // { - // STrace.LogExThrow(); - // throw new ArgumentException("Couldn't load assembly by reflection"); - // } - - // Type type = assembly.GetType(className); - // if (type == null) - // { - // STrace.LogExThrow(); - // throw new ArgumentException("Couldn't find class by reflection"); - // } - - // // if we need to call a polymorphic method, use type.GetMethod(string, BindingFlags, null, Type[], null) - // MethodInfo method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - - // if (method == null) - // { - // STrace.LogExThrow(); - // throw new ArgumentException("Couldn't find method by reflection"); - // } - - // return method.Invoke(null, parameters); - //} - public static bool IsYukonOrAbove(SMO.Server server) { return server.Version.Major >= 9; @@ -340,51 +253,10 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin return server.Version.Major < 9; } - /// - /// Some calendars, such as the UmAlQuraCalendar, support an upper date range that is earlier than MaxValue. - /// In these cases, trying to access MaxValue in variable assignments or formatting and parsing operations can throw - /// an ArgumentOutOfRangeException. Rather than retrieving the value of DateTime.MaxValue, you can retrieve the value - /// of the specified culture's latest valid date value from the - /// System.Globalization.CultureInfo.DateTimeFormat.Calendar.MaxSupportedDateTime property. - /// http://msdn.microsoft.com/en-us/library/system.datetime.maxvalue(v=VS.90).aspx - /// - /// - //public static DateTime GetMaxCultureDateTime() - //{ - // CultureInfo currentCulture = System.Threading.Thread.CurrentThread.CU; - // return currentCulture.DateTimeFormat.Calendar.MaxSupportedDateTime; - //} - public static string MakeSqlBracket(string s) { return "[" + s.Replace("]", "]]") + "]"; } - - /// - /// Displays F1 Help link - /// - /// Service provider to display help - /// F1 help link - //public static void DisplayHelp(IServiceProvider serviceProvider, string dialogF1Keyword) - //{ - // if (serviceProvider == null) - // { - // return; - // } - // IHelpService helpService = (IHelpService)serviceProvider.GetService(typeof(IHelpService)); - // if (helpService == null) - // { - // IHelpProvider helpProvider = (IHelpProvider)serviceProvider.GetService(typeof(IHelpProvider)); - // if (helpProvider != null) - // { - // helpProvider.DisplayTopicFromF1Keyword(dialogF1Keyword); - // } - // } - // else - // { - // helpService.DisplayHelp(dialogF1Keyword); - // } - //} } /// diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Admin/DatabaseAdminTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Admin/DatabaseAdminTests.cs index 812c0a86..df1967ec 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Admin/DatabaseAdminTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Admin/DatabaseAdminTests.cs @@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AdminServices /// /// Validate creating a database with valid input /// - [Fact] + // [Fact] public async void CreateDatabaseWithValidInputTest() { var result = GetLiveAutoCompleteTestObjects();