Skip to content

Commit

Permalink
Drop Asynchronous Processing connection property + Improve connection…
Browse files Browse the repository at this point in the history
… string docs (dotnet#1148)
  • Loading branch information
Johnny Pham authored and Davoud Eshtehari committed Aug 31, 2021
1 parent a351b5d commit ceaf159
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 273 deletions.
4 changes: 2 additions & 2 deletions doc/samples/RegisterCustomKeyStoreProvider_Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

class Program
{
// Links a SqlColumnEncryptionKeyStoreProvider to some object that represents a user
static Dictionary<object, SqlColumnEncryptionKeyStoreProvider> providerByUser = new();
// Maps a SqlColumnEncryptionAzureKeyVaultProvider to some object that represents a user
static Dictionary<object, SqlColumnEncryptionAzureKeyVaultProvider> providerByUser = new();

void ExecuteSelectQuery(object user, SqlConnection connection)
{
Expand Down
88 changes: 0 additions & 88 deletions doc/samples/SqlConnectionStringBuilder_AsynchronousProcessing.cs

This file was deleted.

19 changes: 9 additions & 10 deletions doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml

Large diffs are not rendered by default.

211 changes: 154 additions & 57 deletions doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ internal static partial class DbConnectionStringKeywords
// SqlClient
internal const string ApplicationIntent = "Application Intent";
internal const string ApplicationName = "Application Name";
internal const string AsynchronousProcessing = "Asynchronous Processing";
internal const string AttachDBFilename = "AttachDbFilename";
internal const string CommandTimeout = "Command Timeout";
internal const string ConnectTimeout = "Connect Timeout";
Expand Down Expand Up @@ -939,9 +938,6 @@ internal static partial class DbConnectionStringKeywords

internal static class DbConnectionStringSynonyms
{
//internal const string AsynchronousProcessing = Async;
internal const string Async = "async";

//internal const string ApplicationName = APP;
internal const string APP = "app";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ internal static class KEY
{
internal const string ApplicationIntent = "application intent";
internal const string Application_Name = "application name";
internal const string AsynchronousProcessing = "asynchronous processing";
internal const string AttachDBFilename = "attachdbfilename";
#if NETCOREAPP
internal const string PoolBlockingPeriod = "pool blocking period";
Expand Down Expand Up @@ -114,7 +113,6 @@ private static class SYNONYM
internal const string APPLICATIONINTENT = "applicationintent";
// application name
internal const string APP = "app";
internal const string Async = "async";
// attachDBFilename
internal const string EXTENDED_PROPERTIES = "extended properties";
internal const string INITIAL_FILE_NAME = "initial file name";
Expand Down Expand Up @@ -252,7 +250,6 @@ internal static class TRANSACTIONBINDING

internal SqlConnectionString(string connectionString) : base(connectionString, GetParseSynonyms())
{
ThrowUnsupportedIfKeywordSet(KEY.AsynchronousProcessing);
ThrowUnsupportedIfKeywordSet(KEY.Connection_Reset);
ThrowUnsupportedIfKeywordSet(KEY.Context_Connection);

Expand Down Expand Up @@ -660,7 +657,6 @@ internal static Dictionary<string, string> GetParseSynonyms()
{
{ KEY.ApplicationIntent, KEY.ApplicationIntent },
{ KEY.Application_Name, KEY.Application_Name },
{ KEY.AsynchronousProcessing, KEY.AsynchronousProcessing },
{ KEY.AttachDBFilename, KEY.AttachDBFilename },
#if NETCOREAPP
{ KEY.PoolBlockingPeriod, KEY.PoolBlockingPeriod},
Expand Down Expand Up @@ -703,7 +699,6 @@ internal static Dictionary<string, string> GetParseSynonyms()

{ SYNONYM.APP, KEY.Application_Name },
{ SYNONYM.APPLICATIONINTENT, KEY.ApplicationIntent },
{ SYNONYM.Async, KEY.AsynchronousProcessing },
{ SYNONYM.EXTENDED_PROPERTIES, KEY.AttachDBFilename },
{ SYNONYM.INITIAL_FILE_NAME, KEY.AttachDBFilename },
{ SYNONYM.CONNECTRETRYCOUNT, KEY.Connect_Retry_Count },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1234,12 +1234,9 @@ public override bool TryGetValue(string keyword, out object value)
}

private static readonly string[] s_notSupportedKeywords = new string[] {
DbConnectionStringKeywords.AsynchronousProcessing,
DbConnectionStringKeywords.ConnectionReset,
DbConnectionStringKeywords.ContextConnection,
DbConnectionStringKeywords.TransactionBinding,

DbConnectionStringSynonyms.Async
};

private static readonly string[] s_notSupportedNetworkLibraryKeywords = new string[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,6 @@ public SqlConnectionStringBuilder(string connectionString) { }
[System.ComponentModel.DisplayNameAttribute("Application Name")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public string ApplicationName { get { throw null; } set { } }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/AsynchronousProcessing/*'/>
[System.ComponentModel.DisplayNameAttribute("Asynchronous Processing")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ObsoleteAttribute("AsynchronousProcessing has been deprecated. SqlConnection will ignore the 'Asynchronous Processing' keyword and always allow asynchronous processing.")]
public bool AsynchronousProcessing { get { throw null; } set { } }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/AttachDBFilename/*'/>
[System.ComponentModel.DisplayNameAttribute("AttachDbFilename")]
[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,6 @@ internal static class DbConnectionStringDefaults
// SqlClient
internal const ApplicationIntent ApplicationIntent = Microsoft.Data.SqlClient.ApplicationIntent.ReadWrite;
internal const string ApplicationName = "Framework Microsoft SqlClient Data Provider";
internal const bool AsynchronousProcessing = false;
internal const string AttachDBFilename = _emptyString;
internal const int CommandTimeout = 30;
internal const int ConnectTimeout = 15;
Expand Down Expand Up @@ -1262,7 +1261,6 @@ internal static class DbConnectionStringKeywords
// SqlClient
internal const string ApplicationIntent = "Application Intent";
internal const string ApplicationName = "Application Name";
internal const string AsynchronousProcessing = "Asynchronous Processing";
internal const string AttachDBFilename = "AttachDbFilename";
internal const string ConnectTimeout = "Connect Timeout";
internal const string CommandTimeout = "Command Timeout";
Expand Down Expand Up @@ -1310,9 +1308,6 @@ internal static class DbConnectionStringKeywords

internal static class DbConnectionStringSynonyms
{
//internal const string AsynchronousProcessing = Async;
internal const string Async = "async";

//internal const string ApplicationName = APP;
internal const string APP = "app";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ internal static class KEY
{
internal const string ApplicationIntent = "application intent";
internal const string Application_Name = "application name";
internal const string AsynchronousProcessing = "asynchronous processing";
internal const string AttachDBFilename = "attachdbfilename";
internal const string PoolBlockingPeriod = "pool blocking period";
internal const string ColumnEncryptionSetting = "column encryption setting";
Expand Down Expand Up @@ -290,8 +289,6 @@ internal SqlConnectionString(string connectionString) : base(connectionString, G

_integratedSecurity = ConvertValueToIntegratedSecurity();

ConvertValueToBoolean(KEY.AsynchronousProcessing, DEFAULT.Asynchronous); // while we don't use it anymore, we still need to verify it is true/false

// SQLPT 41700: Ignore ResetConnection=False (still validate the keyword/value)
_poolBlockingPeriod = ConvertValueToPoolBlockingPeriod();
_connectionReset = ConvertValueToBoolean(KEY.Connection_Reset, DEFAULT.Connection_Reset);
Expand Down Expand Up @@ -796,7 +793,6 @@ internal static Hashtable GetParseSynonyms()
hash = new Hashtable(SqlConnectionStringBuilder.KeywordsCount + SynonymCount);
hash.Add(KEY.ApplicationIntent, KEY.ApplicationIntent);
hash.Add(KEY.Application_Name, KEY.Application_Name);
hash.Add(KEY.AsynchronousProcessing, KEY.AsynchronousProcessing);
hash.Add(KEY.AttachDBFilename, KEY.AttachDBFilename);
hash.Add(KEY.PoolBlockingPeriod, KEY.PoolBlockingPeriod);
hash.Add(KEY.Connect_Timeout, KEY.Connect_Timeout);
Expand Down Expand Up @@ -840,7 +836,6 @@ internal static Hashtable GetParseSynonyms()
#endif
hash.Add(SYNONYM.APPLICATIONINTENT, KEY.ApplicationIntent);
hash.Add(SYNONYM.APP, KEY.Application_Name);
hash.Add(SYNONYM.Async, KEY.AsynchronousProcessing);
hash.Add(SYNONYM.EXTENDED_PROPERTIES, KEY.AttachDBFilename);
hash.Add(SYNONYM.INITIAL_FILE_NAME, KEY.AttachDBFilename);
hash.Add(SYNONYM.CONNECTION_TIMEOUT, KEY.Connect_Timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ private enum Keywords
MinPoolSize,
MaxPoolSize,
PoolBlockingPeriod,
AsynchronousProcessing,
ConnectionReset,
MultipleActiveResultSets,
Replication,
Expand Down Expand Up @@ -101,7 +100,6 @@ private enum Keywords
private int _packetSize = DbConnectionStringDefaults.PacketSize;
private int _connectRetryCount = DbConnectionStringDefaults.ConnectRetryCount;
private int _connectRetryInterval = DbConnectionStringDefaults.ConnectRetryInterval;
private bool _asynchronousProcessing = DbConnectionStringDefaults.AsynchronousProcessing;
private bool _connectionReset = DbConnectionStringDefaults.ConnectionReset;
private bool _contextConnection = DbConnectionStringDefaults.ContextConnection;
private bool _encrypt = DbConnectionStringDefaults.Encrypt;
Expand Down Expand Up @@ -131,7 +129,6 @@ static SqlConnectionStringBuilder()
string[] validKeywords = new string[KeywordsCount];
validKeywords[(int)Keywords.ApplicationIntent] = DbConnectionStringKeywords.ApplicationIntent;
validKeywords[(int)Keywords.ApplicationName] = DbConnectionStringKeywords.ApplicationName;
validKeywords[(int)Keywords.AsynchronousProcessing] = DbConnectionStringKeywords.AsynchronousProcessing;
validKeywords[(int)Keywords.AttachDBFilename] = DbConnectionStringKeywords.AttachDBFilename;
validKeywords[(int)Keywords.PoolBlockingPeriod] = DbConnectionStringKeywords.PoolBlockingPeriod;
validKeywords[(int)Keywords.ConnectionReset] = DbConnectionStringKeywords.ConnectionReset;
Expand Down Expand Up @@ -179,7 +176,6 @@ static SqlConnectionStringBuilder()
Dictionary<string, Keywords> hash = new Dictionary<string, Keywords>(KeywordsCount + SqlConnectionString.SynonymCount, StringComparer.OrdinalIgnoreCase);
hash.Add(DbConnectionStringKeywords.ApplicationIntent, Keywords.ApplicationIntent);
hash.Add(DbConnectionStringKeywords.ApplicationName, Keywords.ApplicationName);
hash.Add(DbConnectionStringKeywords.AsynchronousProcessing, Keywords.AsynchronousProcessing);
hash.Add(DbConnectionStringKeywords.AttachDBFilename, Keywords.AttachDBFilename);
hash.Add(DbConnectionStringKeywords.PoolBlockingPeriod, Keywords.PoolBlockingPeriod);
hash.Add(DbConnectionStringKeywords.ConnectTimeout, Keywords.ConnectTimeout);
Expand Down Expand Up @@ -225,7 +221,6 @@ static SqlConnectionStringBuilder()
hash.Add(DbConnectionStringSynonyms.IPADDRESSPREFERENCE, Keywords.IPAddressPreference);
hash.Add(DbConnectionStringSynonyms.APP, Keywords.ApplicationName);
hash.Add(DbConnectionStringSynonyms.APPLICATIONINTENT, Keywords.ApplicationIntent);
hash.Add(DbConnectionStringSynonyms.Async, Keywords.AsynchronousProcessing);
hash.Add(DbConnectionStringSynonyms.EXTENDEDPROPERTIES, Keywords.AttachDBFilename);
hash.Add(DbConnectionStringSynonyms.INITIALFILENAME, Keywords.AttachDBFilename);
hash.Add(DbConnectionStringSynonyms.CONNECTIONTIMEOUT, Keywords.ConnectTimeout);
Expand Down Expand Up @@ -370,11 +365,6 @@ public override object this[string keyword]
Certificate = ConvertToString(value);
break;
#endif
#pragma warning disable 618 // Obsolete AsynchronousProcessing
case Keywords.AsynchronousProcessing:
AsynchronousProcessing = ConvertToBoolean(value);
break;
#pragma warning restore 618
case Keywords.PoolBlockingPeriod:
PoolBlockingPeriod = ConvertToPoolBlockingPeriod(keyword, value);
break;
Expand Down Expand Up @@ -471,22 +461,6 @@ public string ApplicationName
}
}

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/AsynchronousProcessing/*' />
[DisplayName(DbConnectionStringKeywords.AsynchronousProcessing)]
[Obsolete("AsynchronousProcessing has been deprecated. SqlConnection will ignore the 'Asynchronous Processing' keyword and always allow asynchronous processing.")]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Initialization)]
[ResDescriptionAttribute(StringsHelper.ResourceNames.DbConnectionString_AsynchronousProcessing)]
[RefreshPropertiesAttribute(RefreshProperties.All)]
public bool AsynchronousProcessing
{
get { return _asynchronousProcessing; }
set
{
SetValue(DbConnectionStringKeywords.AsynchronousProcessing, value);
_asynchronousProcessing = value;
}
}

/// <include file='..\..\..\..\..\..\..\doc\snippets\Microsoft.Data.SqlClient\SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/AttachDBFilename/*' />
[DisplayName(DbConnectionStringKeywords.AttachDBFilename)]
[ResCategoryAttribute(StringsHelper.ResourceNames.DataCategory_Source)]
Expand Down Expand Up @@ -1311,10 +1285,6 @@ private object GetAt(Keywords index)
return this.ApplicationIntent;
case Keywords.ApplicationName:
return ApplicationName;
#pragma warning disable 618 // Obsolete AsynchronousProcessing
case Keywords.AsynchronousProcessing:
return AsynchronousProcessing;
#pragma warning restore 618
case Keywords.AttachDBFilename:
return AttachDBFilename;
case Keywords.PoolBlockingPeriod:
Expand Down Expand Up @@ -1468,9 +1438,6 @@ private void Reset(Keywords index)
case Keywords.ApplicationName:
_applicationName = DbConnectionStringDefaults.ApplicationName;
break;
case Keywords.AsynchronousProcessing:
_asynchronousProcessing = DbConnectionStringDefaults.AsynchronousProcessing;
break;
case Keywords.AttachDBFilename:
_attachDBFilename = DbConnectionStringDefaults.AttachDBFilename;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1536,9 +1536,6 @@ private static SqlConnectionContainerHashHelper GetHashHelper(string connectionS
// This logic is done here to enable us to have the complete connection string now to be used
// for tracing as we flow through the logic.
connectionStringBuilder = new SqlConnectionStringBuilder(connectionString);
#pragma warning disable CS0618 // Obsolete AsynchronousProcessing
connectionStringBuilder.AsynchronousProcessing = true;
#pragma warning restore CS0618
connectionStringBuilder.Pooling = false;
connectionStringBuilder.Enlist = false;
connectionStringBuilder.ConnectRetryCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,6 @@ static internal Exception ConnectionLockedForBcpEvent()
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_ConnectionLockedForBcpEvent));
}
static internal Exception AsyncConnectionRequired()
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_AsyncConnectionRequired));
}
static internal Exception FatalTimeout()
{
return ADP.InvalidOperation(StringsHelper.GetString(Strings.SQL_FatalTimeout));
Expand Down
Loading

0 comments on commit ceaf159

Please sign in to comment.