Microsoft.Data.SqlClient.LocalAppContextSwitches
This class provides immutable access to the app context switches used
throughout the codebase. Each switch value is read once (on first access)
and cached for future access. Most switch values are obtained solely from
the AppContext, but some switches may use other mechanisms to determine
their values as well (e.g. environment variables).
Transparent Network IP Resolution (TNIR) is a revision of the existing
MultiSubnetFailover feature. TNIR affects the connection sequence of
the driver in the case where the first resolved IP of the hostname
doesn't respond and there are multiple IPs associated with the hostname.
TNIR interacts with MultiSubnetFailover to provide the following three
connection sequences:
0: One IP is attempted, followed by all IPs in parallel
1: All IPs are attempted in parallel
2: All IPs are attempted one after another
TransparentNetworkIPResolution is enabled by default.
MultiSubnetFailover is disabled by default. To disable TNIR, you can
enable the app context switch.
The default value of this switch is false.
When set to true, the default value for MultiSubnetFailover connection
string property will be true instead of false. This enables parallel IP
connection attempts for improved connection times in multi-subnet
environments.
The default value of this switch is false.
.NET Framework does not support Globalization Invariant mode, so this
will always be false.
When set to true, the failover partner provided by the server during
connection will be ignored. This is useful in scenarios where the
application wants to control the failover behavior explicitly (e.g.
using a custom port). The application must be kept up to date with the
failover configuration of the server. The application will not
automatically discover a newly configured failover partner.
The default value of this switch is false.
In System.Data.SqlClient and Microsoft.Data.SqlClient prior to 3.0.0 a
field with type Timestamp/RowVersion would return an empty byte array.
This switch controls whether to preserve that behaviour on newer
versions of Microsoft.Data.SqlClient, if this switch returns false an
appropriate null value will be returned.
The default value of this switch is false.
When set to 'true' this will output a scale value of 7
(DEFAULT_VARTIME_SCALE) when the scale is explicitly set to zero for
VarTime data types ('datetime2', 'datetimeoffset' and 'time') If no
scale is set explicitly it will continue to output scale of 7
(DEFAULT_VARTIME_SCALE) regardless of switch value.
The default value of this switch is true.
When enabled, ReadAsync runs asynchronously and does not block the
calling thread.
The default value of this switch is false.
When using Encrypt=false in the connection string, a security warning is
output to the console if the TLS version is 1.2 or lower. This warning
can be suppressed by enabling this AppContext switch.
The default value of this switch is false.
When set to true, TdsParser will truncate (rather than round) decimal
and SqlDecimal values when scaling them.
The default value of this switch is false.
In TdsParser, the async multi-packet column value fetch behavior can use
a continue snapshot state for improved efficiency. When this switch is
enabled (the default), the driver preserves the legacy compatibility
behavior, which does not use the continue snapshot state. When disabled,
the new behavior using the continue snapshot state is enabled.
This switch will always return true if
UseCompatibilityProcessSni is enabled, because the
continue state is not stable without the multiplexer.
The default value of this switch is true.
In TdsParser, the ProcessSni function changed significantly when the
packet multiplexing code needed for high speed multi-packet column
values was added. When this switch is set to true (the default), the
old ProcessSni design is used. When this switch is set to false, the
new experimental ProcessSni behavior using the packet multiplexer is
enabled.
The default value of this switch is true.
When set to true, the connection pool will use the new V2 connection
pool implementation. When set to false, the connection pool will use
the legacy V1 implementation.
The default value of this switch is false.
.NET Framework does not support the managed SNI, so this will always be
false.
Specifies minimum login timeout to be set to 1 second instead of 0
seconds, to prevent a login attempt from waiting indefinitely.
The default value of this switch is true.