Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<Compile Include="..\..\src\Microsoft\Data\Common\ActivityCorrelator.cs">
<Link>Microsoft\Data\Common\ActivityCorrelator.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\Common\DbConnectionStringCommon.cs">
<Link>Microsoft\Data\Common\DbConnectionStringCommon.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\Common\DbConnectionPoolKey.cs">
<Link>Microsoft\Data\Common\DbConnectionPoolKey.cs</Link>
</Compile>
Expand Down Expand Up @@ -434,7 +437,6 @@
<Compile Include="$(CommonPath)\Microsoft\Data\Common\DbConnectionOptions.Common.cs">
<Link>Microsoft\Data\Common\DbConnectionOptions.Common.cs</Link>
</Compile>
<Compile Include="Microsoft\Data\Common\DbConnectionStringCommon.cs" />
<Compile Include="$(CommonPath)\Microsoft\Data\ProviderBase\DbConnectionInternal.cs">
<Link>Common\Microsoft\Data\ProviderBase\DbConnectionInternal.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
<Compile Include="..\..\src\Microsoft\Data\Common\ActivityCorrelator.cs">
<Link>Microsoft\Data\Common\ActivityCorrelator.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\Common\DbConnectionStringCommon.cs">
<Link>Microsoft\Data\Common\DbConnectionStringCommon.cs</Link>
</Compile>
<Compile Include="..\..\src\Microsoft\Data\Common\DbConnectionPoolKey.cs">
<Link>Microsoft\Data\Common\DbConnectionPoolKey.cs</Link>
</Compile>
Expand Down Expand Up @@ -513,7 +516,6 @@
<Compile Include="Microsoft\Data\Common\AdapterSwitches.cs" />
<Compile Include="Microsoft\Data\Common\AdapterUtil.cs" />
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />
<Compile Include="Microsoft\Data\Common\DbConnectionStringCommon.cs" />
<Compile Include="Microsoft\Data\Common\DbConnectionString.cs" />
<Compile Include="Microsoft\Data\Common\UnsafeNativeMethods.cs" />
<Compile Include="Microsoft\Data\Common\SafeNativeMethods.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,98 +497,6 @@ internal static string ExpandDataDirectory(string keyword, string value, ref str
return fullPath;
}

internal string ExpandDataDirectories(ref string filename, ref int position)
{
string value = null;
StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
string datadir = null;

int copyPosition = 0;
bool expanded = false;

for (NameValuePair current = KeyChain; null != current; current = current.Next)
{
value = current.Value;

// remove duplicate keyswords from connectionstring
//if ((object)this[current.Name] != (object)value) {
// expanded = true;
// copyPosition += current.Length;
// continue;
//}

// There is a set of keywords we explictly do NOT want to expand |DataDirectory| on
if (UseOdbcRules)
{
switch (current.Name)
{
case DbConnectionOptionKeywords.Driver:
case DbConnectionOptionKeywords.Pwd:
case DbConnectionOptionKeywords.UID:
break;
default:
value = ExpandDataDirectory(current.Name, value, ref datadir);
break;
}
}
else
{
switch (current.Name)
{
case DbConnectionOptionKeywords.Provider:
case DbConnectionOptionKeywords.DataProvider:
case DbConnectionOptionKeywords.RemoteProvider:
case DbConnectionOptionKeywords.ExtendedProperties:
case DbConnectionOptionKeywords.UserID:
case DbConnectionOptionKeywords.Password:
case DbConnectionOptionKeywords.UID:
case DbConnectionOptionKeywords.Pwd:
break;
default:
value = ExpandDataDirectory(current.Name, value, ref datadir);
break;
}
}
if (null == value)
{
value = current.Value;
}
if (UseOdbcRules || (DbConnectionOptionKeywords.FileName != current.Name))
{
if (value != current.Value)
{
expanded = true;
AppendKeyValuePairBuilder(builder, current.Name, value, UseOdbcRules);
builder.Append(';');
}
else
{
builder.Append(_usersConnectionString, copyPosition, current.Length);
}
}
else
{
// strip out 'File Name=myconnection.udl' for OleDb
// remembering is value for which UDL file to open
// and where to insert the strnig
expanded = true;
filename = value;
position = builder.Length;
}
copyPosition += current.Length;
}

if (expanded)
{
value = builder.ToString();
}
else
{
value = null;
}
return value;
}

internal string ExpandKeyword(string keyword, string replacementValue)
{
// preserve duplicates, updated keyword value with replacement value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
Expand Down Expand Up @@ -1178,13 +1179,7 @@ public override bool IsFixedSize
}

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/Keys/*' />
public override ICollection Keys
{
get
{
return new Microsoft.Data.Common.ReadOnlyCollection<string>(_validKeywords);
}
}
public override ICollection Keys => new ReadOnlyCollection<string>(_validKeywords);

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/Values/*' />
public override ICollection Values
Expand All @@ -1198,7 +1193,7 @@ public override ICollection Values
{
values[i] = GetAt((Keywords)i);
}
return new Microsoft.Data.Common.ReadOnlyCollection<object>(values);
return new ReadOnlyCollection<object>(values);
}
}

Expand Down
Loading