@@ -67,18 +67,21 @@ static LocalAppContextSwitches()
67
67
#endif
68
68
69
69
/// <summary>
70
- /// In TdsParser the ProcessSni function changed significantly when the packet
70
+ /// In TdsParser, the ProcessSni function changed significantly when the packet
71
71
/// multiplexing code needed for high speed multi-packet column values was added.
72
- /// In case of compatibility problems this switch will change TdsParser to use
73
- /// the previous version of the function.
72
+ /// When this switch is set to true (the default), the old ProcessSni design is used.
73
+ /// When this switch is set to false, the new experimental ProcessSni behavior using
74
+ /// the packet multiplexer is enabled.
74
75
/// </summary>
75
76
public static bool UseCompatibilityProcessSni
76
77
{
77
78
get
78
79
{
79
80
if ( s_useCompatibilityProcessSni == Tristate . NotInitialized )
80
81
{
81
- if ( AppContext . TryGetSwitch ( UseCompatibilityProcessSniString , out bool returnedValue ) && returnedValue )
82
+ // Check if the switch has been set by the AppContext switch directly
83
+ // If it has not been set, we default to true.
84
+ if ( ! AppContext . TryGetSwitch ( UseCompatibilityProcessSniString , out bool returnedValue ) || returnedValue )
82
85
{
83
86
s_useCompatibilityProcessSni = Tristate . True ;
84
87
}
@@ -92,12 +95,12 @@ public static bool UseCompatibilityProcessSni
92
95
}
93
96
94
97
/// <summary>
95
- /// In TdsParser the async multi-packet column value fetch behaviour is capable of
96
- /// using a continue snapshot state in addition to the original replay from start
97
- /// logic.
98
- /// This switch disables use of the continue snapshot state. This switch will always
99
- /// return true if <see cref="UseCompatibilityProcessSni"/> is enabled because the
100
- /// continue state is not stable without the multiplexer.
98
+ /// In TdsParser, the async multi-packet column value fetch behavior can use a continue snapshot state
99
+ /// for improved efficiency. When this switch is enabled ( the default), the driver preserves the legacy
100
+ /// compatibility behavior, which does not use the continue snapshot state. When disabled, the new behavior
101
+ /// using the continue snapshot state is enabled . This switch will always return true if
102
+ /// <see cref="UseCompatibilityProcessSni"/> is enabled, because the continue state is not stable without
103
+ /// the multiplexer.
101
104
/// </summary>
102
105
public static bool UseCompatibilityAsyncBehaviour
103
106
{
@@ -114,7 +117,7 @@ public static bool UseCompatibilityAsyncBehaviour
114
117
115
118
if ( s_useCompatibilityAsyncBehaviour == Tristate . NotInitialized )
116
119
{
117
- if ( AppContext . TryGetSwitch ( UseCompatibilityAsyncBehaviourString , out bool returnedValue ) && returnedValue )
120
+ if ( ! AppContext . TryGetSwitch ( UseCompatibilityAsyncBehaviourString , out bool returnedValue ) || returnedValue )
118
121
{
119
122
s_useCompatibilityAsyncBehaviour = Tristate . True ;
120
123
}
0 commit comments