diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
index 0321ff4dfd..1ff1dc373a 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -391,6 +391,15 @@
Microsoft\Data\SqlClient\LocalDBAPI.Windows.cs
+
+ Microsoft\Data\SqlClient\LocalDb\LocalDbConfigurationSection.netfx.cs
+
+
+ Microsoft\Data\SqlClient\LocalDb\LocalDbInstanceElement.netfx.cs
+
+
+ Microsoft\Data\SqlClient\LocalDb\LocalDbInstancesCollection.netfx.cs
+
Microsoft\Data\SqlClient\LocalAppContextSwitches.cs
@@ -839,7 +848,6 @@
-
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/LocalDBConfig.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/LocalDBConfig.cs
deleted file mode 100644
index 4c830520d9..0000000000
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/LocalDBConfig.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace Microsoft.Data
-{
- using System;
- using System.Collections;
- using System.Configuration;
-
- internal sealed class LocalDBInstanceElement : ConfigurationElement
- {
- [ConfigurationProperty("name", IsRequired = true)]
- public string Name
- {
- get
- {
- return this["name"] as string;
- }
- }
-
- [ConfigurationProperty("version", IsRequired = true)]
- public string Version
- {
- get
- {
- return this["version"] as string;
- }
- }
- }
-
- internal sealed class LocalDBInstancesCollection : ConfigurationElementCollection
- {
-
- private class TrimOrdinalIgnoreCaseStringComparer : IComparer
- {
- public int Compare(object x, object y)
- {
- string xStr = x as string;
- if (xStr != null)
- x = xStr.Trim();
-
- string yStr = y as string;
- if (yStr != null)
- y = yStr.Trim();
-
- return StringComparer.OrdinalIgnoreCase.Compare(x, y);
- }
- }
-
- static readonly TrimOrdinalIgnoreCaseStringComparer s_comparer = new TrimOrdinalIgnoreCaseStringComparer();
-
- internal LocalDBInstancesCollection()
- : base(s_comparer)
- {
- }
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new LocalDBInstanceElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((LocalDBInstanceElement)element).Name;
- }
-
- }
-
- internal sealed class LocalDBConfigurationSection : ConfigurationSection
- {
- [ConfigurationProperty("localdbinstances", IsRequired = true)]
- public LocalDBInstancesCollection LocalDbInstances
- {
- get
- {
- return (LocalDBInstancesCollection)this["localdbinstances"] ?? new LocalDBInstancesCollection();
- }
- }
- }
-}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
index f42fe42b2c..70f6b3ff2c 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDBAPI.Windows.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDBAPI.Windows.cs
index 77194052da..efdad34495 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDBAPI.Windows.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDBAPI.Windows.cs
@@ -8,15 +8,16 @@
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
+using Interop.Windows.Kernel32;
using Interop.Windows.Sni;
using Microsoft.Data.SqlClient;
-using Interop.Windows.Kernel32;
#if NETFRAMEWORK
using System.Collections.Generic;
using System.Configuration;
using System.Runtime.CompilerServices;
using System.Threading;
+using Microsoft.Data.SqlClient.LocalDb;
#endif
namespace Microsoft.Data
@@ -182,13 +183,13 @@ internal static void CreateLocalDBInstance(string instance)
if (section != null) // if no section just skip creation
{
// validate section type
- LocalDBConfigurationSection configSection = section as LocalDBConfigurationSection;
+ LocalDbConfigurationSection configSection = section as LocalDbConfigurationSection;
if (configSection == null)
{
throw CreateLocalDBException(errorMessage: StringsHelper.GetString("LocalDB_BadConfigSectionType"));
}
-
- foreach (LocalDBInstanceElement confElement in configSection.LocalDbInstances)
+
+ foreach (LocalDbInstanceElement confElement in configSection.LocalDbInstances)
{
Debug.Assert(confElement.Name != null && confElement.Version != null, "Both name and version should not be null");
tempConfigurableInstances.Add(confElement.Name.Trim(), new InstanceInfo(confElement.Version.Trim()));
@@ -215,7 +216,7 @@ internal static void CreateLocalDBInstance(string instance)
if (!s_configurableInstances.TryGetValue(instance, out instanceInfo))
{
// instance name was not in the config
- return;
+ return;
}
if (instanceInfo.created)
@@ -364,7 +365,7 @@ private static SqlException CreateLocalDBException(string errorMessage, string i
if (localDbError != 0)
{
- collection.Add(new SqlError(errorCode, 0, TdsEnums.FATAL_ERROR_CLASS, instance, GetLocalDBMessage(localDbError), null, 0));
+ collection.Add(new SqlError(errorCode, 0, TdsEnums.FATAL_ERROR_CLASS, instance, GetLocalDBMessage(localDbError), null, 0));
}
SqlException exc = SqlException.CreateException(collection, null);
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbConfigurationSection.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbConfigurationSection.netfx.cs
new file mode 100644
index 0000000000..4fdb66788b
--- /dev/null
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbConfigurationSection.netfx.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if NETFRAMEWORK
+
+using System.Configuration;
+
+namespace Microsoft.Data.SqlClient.LocalDb
+{
+ internal sealed class LocalDbConfigurationSection : ConfigurationSection
+ {
+ [ConfigurationProperty("localdbinstances", IsRequired = true)]
+ public LocalDbInstancesCollection LocalDbInstances =>
+ (LocalDbInstancesCollection)this["localdbinstances"] ?? new LocalDbInstancesCollection();
+ }
+}
+
+#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstanceElement.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstanceElement.netfx.cs
new file mode 100644
index 0000000000..ef35b59116
--- /dev/null
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstanceElement.netfx.cs
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if NETFRAMEWORK
+
+using System.Configuration;
+
+namespace Microsoft.Data.SqlClient.LocalDb
+{
+ internal sealed class LocalDbInstanceElement : ConfigurationElement
+ {
+ [ConfigurationProperty("name", IsRequired = true)]
+ public string Name => this["name"] as string;
+
+ [ConfigurationProperty("version", IsRequired = true)]
+ public string Version => this["version"] as string;
+ }
+}
+
+#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstancesCollection.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstancesCollection.netfx.cs
new file mode 100644
index 0000000000..64860a991a
--- /dev/null
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalDb/LocalDbInstancesCollection.netfx.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#if NETFRAMEWORK
+
+using System;
+using System.Collections;
+using System.Configuration;
+
+namespace Microsoft.Data.SqlClient.LocalDb
+{
+ internal sealed class LocalDbInstancesCollection : ConfigurationElementCollection
+ {
+ private static readonly TrimOrdinalIgnoreCaseStringComparer s_comparer = new TrimOrdinalIgnoreCaseStringComparer();
+
+ internal LocalDbInstancesCollection()
+ : base(s_comparer)
+ {
+ }
+
+ protected override ConfigurationElement CreateNewElement() =>
+ new LocalDbInstanceElement();
+
+ protected override object GetElementKey(ConfigurationElement element) =>
+ ((LocalDbInstanceElement)element).Name;
+
+ private class TrimOrdinalIgnoreCaseStringComparer : IComparer
+ {
+ public int Compare(object x, object y)
+ {
+ if (x is string xStr)
+ {
+ x = xStr.Trim();
+ }
+
+ if (y is string yStr)
+ {
+ y = yStr.Trim();
+ }
+
+ return StringComparer.OrdinalIgnoreCase.Compare(x, y);
+ }
+ }
+ }
+}
+
+#endif