-
Notifications
You must be signed in to change notification settings - Fork 263
/
SqlConnectionStringBuilder.cs
1959 lines (1820 loc) · 98.2 KB
/
SqlConnectionStringBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using Microsoft.Data.Common;
namespace Microsoft.Data.SqlClient
{
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/SqlConnectionStringBuilder/*' />
[DefaultProperty(DbConnectionStringKeywords.DataSource)]
[TypeConverter(typeof(SqlConnectionStringBuilderConverter))]
public sealed class SqlConnectionStringBuilder : DbConnectionStringBuilder
{
/// <summary>
/// specific ordering for ConnectionString output construction
/// </summary>
private enum Keywords
{
DataSource,
FailoverPartner,
AttachDBFilename,
InitialCatalog,
IntegratedSecurity,
PersistSecurityInfo,
UserID,
Password,
Enlist,
Pooling,
MinPoolSize,
MaxPoolSize,
PoolBlockingPeriod,
MultipleActiveResultSets,
Replication,
ConnectTimeout,
Encrypt,
HostNameInCertificate,
ServerCertificate,
TrustServerCertificate,
LoadBalanceTimeout,
PacketSize,
TypeSystemVersion,
Authentication,
ApplicationName,
CurrentLanguage,
WorkstationID,
UserInstance,
TransactionBinding,
ApplicationIntent,
MultiSubnetFailover,
ConnectRetryCount,
ConnectRetryInterval,
ColumnEncryptionSetting,
EnclaveAttestationUrl,
AttestationProtocol,
CommandTimeout,
IPAddressPreference,
ServerSPN,
FailoverPartnerSPN,
#if NETFRAMEWORK
ConnectionReset,
NetworkLibrary,
ContextConnection,
TransparentNetworkIPResolution,
#if ADONET_CERT_AUTH
Certificate,
#endif
#endif
// keep the KeywordsCount value last
KeywordsCount
}
#region Fields
internal const int KeywordsCount = (int)Keywords.KeywordsCount;
private static readonly string[] s_validKeywords = CreateValidKeywords();
private static readonly Dictionary<string, Keywords> s_keywords = CreateKeywordsDictionary();
private ApplicationIntent _applicationIntent = DbConnectionStringDefaults.ApplicationIntent;
private string _applicationName = DbConnectionStringDefaults.ApplicationName;
private string _attachDBFilename = DbConnectionStringDefaults.AttachDBFilename;
private string _currentLanguage = DbConnectionStringDefaults.CurrentLanguage;
private string _dataSource = DbConnectionStringDefaults.DataSource;
private string _failoverPartner = DbConnectionStringDefaults.FailoverPartner;
private string _initialCatalog = DbConnectionStringDefaults.InitialCatalog;
private string _password = DbConnectionStringDefaults.Password;
private string _transactionBinding = DbConnectionStringDefaults.TransactionBinding;
private string _typeSystemVersion = DbConnectionStringDefaults.TypeSystemVersion;
private string _userID = DbConnectionStringDefaults.UserID;
private string _workstationID = DbConnectionStringDefaults.WorkstationID;
private int _commandTimeout = DbConnectionStringDefaults.CommandTimeout;
private int _connectTimeout = DbConnectionStringDefaults.ConnectTimeout;
private int _loadBalanceTimeout = DbConnectionStringDefaults.LoadBalanceTimeout;
private int _maxPoolSize = DbConnectionStringDefaults.MaxPoolSize;
private int _minPoolSize = DbConnectionStringDefaults.MinPoolSize;
private int _packetSize = DbConnectionStringDefaults.PacketSize;
private int _connectRetryCount = DbConnectionStringDefaults.ConnectRetryCount;
private int _connectRetryInterval = DbConnectionStringDefaults.ConnectRetryInterval;
private SqlConnectionEncryptOption _encrypt = DbConnectionStringDefaults.Encrypt;
private string _hostNameInCertificate = DbConnectionStringDefaults.HostNameInCertificate;
private string _serverCertificate = DbConnectionStringDefaults.ServerCertificate;
private bool _trustServerCertificate = DbConnectionStringDefaults.TrustServerCertificate;
private bool _enlist = DbConnectionStringDefaults.Enlist;
private bool _integratedSecurity = DbConnectionStringDefaults.IntegratedSecurity;
private bool _multipleActiveResultSets = DbConnectionStringDefaults.MultipleActiveResultSets;
private bool _multiSubnetFailover = DbConnectionStringDefaults.MultiSubnetFailover;
private bool _persistSecurityInfo = DbConnectionStringDefaults.PersistSecurityInfo;
private PoolBlockingPeriod _poolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
private bool _pooling = DbConnectionStringDefaults.Pooling;
private bool _replication = DbConnectionStringDefaults.Replication;
private bool _userInstance = DbConnectionStringDefaults.UserInstance;
private SqlAuthenticationMethod _authentication = DbConnectionStringDefaults.Authentication;
private SqlConnectionColumnEncryptionSetting _columnEncryptionSetting = DbConnectionStringDefaults.ColumnEncryptionSetting;
private string _enclaveAttestationUrl = DbConnectionStringDefaults.EnclaveAttestationUrl;
private SqlConnectionAttestationProtocol _attestationProtocol = DbConnectionStringDefaults.AttestationProtocol;
private SqlConnectionIPAddressPreference _ipAddressPreference = DbConnectionStringDefaults.IPAddressPreference;
private string _serverSPN = DbConnectionStringDefaults.ServerSPN;
private string _failoverPartnerSPN = DbConnectionStringDefaults.FailoverPartnerSPN;
#if NETFRAMEWORK
private bool _connectionReset = DbConnectionStringDefaults.ConnectionReset;
private bool _contextConnection = DbConnectionStringDefaults.ContextConnection;
private bool _transparentNetworkIPResolution = DbConnectionStringDefaults.TransparentNetworkIPResolution;
private string _networkLibrary = DbConnectionStringDefaults.NetworkLibrary;
#if ADONET_CERT_AUTH
private string _certificate = DbConnectionStringDefaults.Certificate;
#endif
#else
internal const int DeprecatedKeywordsCount = 5;
#endif
#endregion //Fields
#region Private Methods
private static string[] CreateValidKeywords()
{
string[] validKeywords = new string[KeywordsCount];
validKeywords[(int)Keywords.ApplicationIntent] = DbConnectionStringKeywords.ApplicationIntent;
validKeywords[(int)Keywords.ApplicationName] = DbConnectionStringKeywords.ApplicationName;
validKeywords[(int)Keywords.AttachDBFilename] = DbConnectionStringKeywords.AttachDBFilename;
validKeywords[(int)Keywords.PoolBlockingPeriod] = DbConnectionStringKeywords.PoolBlockingPeriod;
validKeywords[(int)Keywords.CommandTimeout] = DbConnectionStringKeywords.CommandTimeout;
validKeywords[(int)Keywords.ConnectTimeout] = DbConnectionStringKeywords.ConnectTimeout;
validKeywords[(int)Keywords.CurrentLanguage] = DbConnectionStringKeywords.CurrentLanguage;
validKeywords[(int)Keywords.DataSource] = DbConnectionStringKeywords.DataSource;
validKeywords[(int)Keywords.Encrypt] = DbConnectionStringKeywords.Encrypt;
validKeywords[(int)Keywords.HostNameInCertificate] = DbConnectionStringKeywords.HostNameInCertificate;
validKeywords[(int)Keywords.ServerCertificate] = DbConnectionStringKeywords.ServerCertificate;
validKeywords[(int)Keywords.Enlist] = DbConnectionStringKeywords.Enlist;
validKeywords[(int)Keywords.FailoverPartner] = DbConnectionStringKeywords.FailoverPartner;
validKeywords[(int)Keywords.InitialCatalog] = DbConnectionStringKeywords.InitialCatalog;
validKeywords[(int)Keywords.IntegratedSecurity] = DbConnectionStringKeywords.IntegratedSecurity;
validKeywords[(int)Keywords.LoadBalanceTimeout] = DbConnectionStringKeywords.LoadBalanceTimeout;
validKeywords[(int)Keywords.MaxPoolSize] = DbConnectionStringKeywords.MaxPoolSize;
validKeywords[(int)Keywords.MinPoolSize] = DbConnectionStringKeywords.MinPoolSize;
validKeywords[(int)Keywords.MultipleActiveResultSets] = DbConnectionStringKeywords.MultipleActiveResultSets;
validKeywords[(int)Keywords.MultiSubnetFailover] = DbConnectionStringKeywords.MultiSubnetFailover;
validKeywords[(int)Keywords.PacketSize] = DbConnectionStringKeywords.PacketSize;
validKeywords[(int)Keywords.Password] = DbConnectionStringKeywords.Password;
validKeywords[(int)Keywords.PersistSecurityInfo] = DbConnectionStringKeywords.PersistSecurityInfo;
validKeywords[(int)Keywords.Pooling] = DbConnectionStringKeywords.Pooling;
validKeywords[(int)Keywords.Replication] = DbConnectionStringKeywords.Replication;
validKeywords[(int)Keywords.TransactionBinding] = DbConnectionStringKeywords.TransactionBinding;
validKeywords[(int)Keywords.TrustServerCertificate] = DbConnectionStringKeywords.TrustServerCertificate;
validKeywords[(int)Keywords.TypeSystemVersion] = DbConnectionStringKeywords.TypeSystemVersion;
validKeywords[(int)Keywords.UserID] = DbConnectionStringKeywords.UserID;
validKeywords[(int)Keywords.UserInstance] = DbConnectionStringKeywords.UserInstance;
validKeywords[(int)Keywords.WorkstationID] = DbConnectionStringKeywords.WorkstationID;
validKeywords[(int)Keywords.ConnectRetryCount] = DbConnectionStringKeywords.ConnectRetryCount;
validKeywords[(int)Keywords.ConnectRetryInterval] = DbConnectionStringKeywords.ConnectRetryInterval;
validKeywords[(int)Keywords.Authentication] = DbConnectionStringKeywords.Authentication;
validKeywords[(int)Keywords.ColumnEncryptionSetting] = DbConnectionStringKeywords.ColumnEncryptionSetting;
validKeywords[(int)Keywords.EnclaveAttestationUrl] = DbConnectionStringKeywords.EnclaveAttestationUrl;
validKeywords[(int)Keywords.AttestationProtocol] = DbConnectionStringKeywords.AttestationProtocol;
validKeywords[(int)Keywords.IPAddressPreference] = DbConnectionStringKeywords.IPAddressPreference;
validKeywords[(int)Keywords.ServerSPN] = DbConnectionStringKeywords.ServerSPN;
validKeywords[(int)Keywords.FailoverPartnerSPN] = DbConnectionStringKeywords.FailoverPartnerSPN;
#if NETFRAMEWORK
validKeywords[(int)Keywords.ConnectionReset] = DbConnectionStringKeywords.ConnectionReset;
validKeywords[(int)Keywords.NetworkLibrary] = DbConnectionStringKeywords.NetworkLibrary;
validKeywords[(int)Keywords.ContextConnection] = DbConnectionStringKeywords.ContextConnection;
validKeywords[(int)Keywords.TransparentNetworkIPResolution] = DbConnectionStringKeywords.TransparentNetworkIPResolution;
#if ADONET_CERT_AUTH
validKeywords[(int)Keywords.Certificate] = DbConnectionStringKeywords.Certificate;
#endif
#endif
return validKeywords;
}
private static Dictionary<string, Keywords> CreateKeywordsDictionary()
{
Dictionary<string, Keywords> pairs = new(KeywordsCount + SqlConnectionString.SynonymCount, StringComparer.OrdinalIgnoreCase)
{
{ DbConnectionStringKeywords.ApplicationIntent, Keywords.ApplicationIntent },
{ DbConnectionStringKeywords.ApplicationName, Keywords.ApplicationName },
{ DbConnectionStringKeywords.AttachDBFilename, Keywords.AttachDBFilename },
{ DbConnectionStringKeywords.PoolBlockingPeriod, Keywords.PoolBlockingPeriod },
{ DbConnectionStringKeywords.CommandTimeout, Keywords.CommandTimeout },
{ DbConnectionStringKeywords.ConnectTimeout, Keywords.ConnectTimeout },
{ DbConnectionStringKeywords.CurrentLanguage, Keywords.CurrentLanguage },
{ DbConnectionStringKeywords.DataSource, Keywords.DataSource },
{ DbConnectionStringKeywords.Encrypt, Keywords.Encrypt },
{ DbConnectionStringKeywords.Enlist, Keywords.Enlist },
{ DbConnectionStringKeywords.FailoverPartner, Keywords.FailoverPartner },
{ DbConnectionStringKeywords.HostNameInCertificate, Keywords.HostNameInCertificate },
{ DbConnectionStringKeywords.ServerCertificate, Keywords.ServerCertificate },
{ DbConnectionStringKeywords.InitialCatalog, Keywords.InitialCatalog },
{ DbConnectionStringKeywords.IntegratedSecurity, Keywords.IntegratedSecurity },
{ DbConnectionStringKeywords.LoadBalanceTimeout, Keywords.LoadBalanceTimeout },
{ DbConnectionStringKeywords.MultipleActiveResultSets, Keywords.MultipleActiveResultSets },
{ DbConnectionStringKeywords.MaxPoolSize, Keywords.MaxPoolSize },
{ DbConnectionStringKeywords.MinPoolSize, Keywords.MinPoolSize },
{ DbConnectionStringKeywords.MultiSubnetFailover, Keywords.MultiSubnetFailover },
{ DbConnectionStringKeywords.PacketSize, Keywords.PacketSize },
{ DbConnectionStringKeywords.Password, Keywords.Password },
{ DbConnectionStringKeywords.PersistSecurityInfo, Keywords.PersistSecurityInfo },
{ DbConnectionStringKeywords.Pooling, Keywords.Pooling },
{ DbConnectionStringKeywords.Replication, Keywords.Replication },
{ DbConnectionStringKeywords.TransactionBinding, Keywords.TransactionBinding },
{ DbConnectionStringKeywords.TrustServerCertificate, Keywords.TrustServerCertificate },
{ DbConnectionStringKeywords.TypeSystemVersion, Keywords.TypeSystemVersion },
{ DbConnectionStringKeywords.UserID, Keywords.UserID },
{ DbConnectionStringKeywords.UserInstance, Keywords.UserInstance },
{ DbConnectionStringKeywords.WorkstationID, Keywords.WorkstationID },
{ DbConnectionStringKeywords.ConnectRetryCount, Keywords.ConnectRetryCount },
{ DbConnectionStringKeywords.ConnectRetryInterval, Keywords.ConnectRetryInterval },
{ DbConnectionStringKeywords.Authentication, Keywords.Authentication },
{ DbConnectionStringKeywords.ColumnEncryptionSetting, Keywords.ColumnEncryptionSetting },
{ DbConnectionStringKeywords.EnclaveAttestationUrl, Keywords.EnclaveAttestationUrl },
{ DbConnectionStringKeywords.AttestationProtocol, Keywords.AttestationProtocol },
{ DbConnectionStringKeywords.IPAddressPreference, Keywords.IPAddressPreference },
{ DbConnectionStringKeywords.ServerSPN, Keywords.ServerSPN },
{ DbConnectionStringKeywords.FailoverPartnerSPN, Keywords.FailoverPartnerSPN },
#if NETFRAMEWORK
{ DbConnectionStringKeywords.ConnectionReset, Keywords.ConnectionReset },
{ DbConnectionStringKeywords.ContextConnection, Keywords.ContextConnection },
{ DbConnectionStringKeywords.TransparentNetworkIPResolution, Keywords.TransparentNetworkIPResolution },
{ DbConnectionStringKeywords.NetworkLibrary, Keywords.NetworkLibrary },
#if ADONET_CERT_AUTH
{ DbConnectionStringKeywords.Certificate, Keywords.Certificate },
#endif
{ DbConnectionStringSynonyms.NET, Keywords.NetworkLibrary },
{ DbConnectionStringSynonyms.NETWORK, Keywords.NetworkLibrary },
{ DbConnectionStringSynonyms.TRANSPARENTNETWORKIPRESOLUTION, Keywords.TransparentNetworkIPResolution },
#endif
{ DbConnectionStringSynonyms.IPADDRESSPREFERENCE, Keywords.IPAddressPreference },
{ DbConnectionStringSynonyms.APP, Keywords.ApplicationName },
{ DbConnectionStringSynonyms.APPLICATIONINTENT, Keywords.ApplicationIntent },
{ DbConnectionStringSynonyms.EXTENDEDPROPERTIES, Keywords.AttachDBFilename },
{ DbConnectionStringSynonyms.HOSTNAMEINCERTIFICATE, Keywords.HostNameInCertificate },
{ DbConnectionStringSynonyms.SERVERCERTIFICATE, Keywords.ServerCertificate },
{ DbConnectionStringSynonyms.INITIALFILENAME, Keywords.AttachDBFilename },
{ DbConnectionStringSynonyms.CONNECTIONTIMEOUT, Keywords.ConnectTimeout },
{ DbConnectionStringSynonyms.CONNECTRETRYCOUNT, Keywords.ConnectRetryCount },
{ DbConnectionStringSynonyms.CONNECTRETRYINTERVAL, Keywords.ConnectRetryInterval },
{ DbConnectionStringSynonyms.TIMEOUT, Keywords.ConnectTimeout },
{ DbConnectionStringSynonyms.LANGUAGE, Keywords.CurrentLanguage },
{ DbConnectionStringSynonyms.ADDR, Keywords.DataSource },
{ DbConnectionStringSynonyms.ADDRESS, Keywords.DataSource },
{ DbConnectionStringSynonyms.MULTIPLEACTIVERESULTSETS, Keywords.MultipleActiveResultSets },
{ DbConnectionStringSynonyms.MULTISUBNETFAILOVER, Keywords.MultiSubnetFailover },
{ DbConnectionStringSynonyms.NETWORKADDRESS, Keywords.DataSource },
{ DbConnectionStringSynonyms.POOLBLOCKINGPERIOD, Keywords.PoolBlockingPeriod },
{ DbConnectionStringSynonyms.SERVER, Keywords.DataSource },
{ DbConnectionStringSynonyms.DATABASE, Keywords.InitialCatalog },
{ DbConnectionStringSynonyms.TRUSTEDCONNECTION, Keywords.IntegratedSecurity },
{ DbConnectionStringSynonyms.TRUSTSERVERCERTIFICATE, Keywords.TrustServerCertificate },
{ DbConnectionStringSynonyms.ConnectionLifetime, Keywords.LoadBalanceTimeout },
{ DbConnectionStringSynonyms.Pwd, Keywords.Password },
{ DbConnectionStringSynonyms.PERSISTSECURITYINFO, Keywords.PersistSecurityInfo },
{ DbConnectionStringSynonyms.UID, Keywords.UserID },
{ DbConnectionStringSynonyms.User, Keywords.UserID },
{ DbConnectionStringSynonyms.WSID, Keywords.WorkstationID },
{ DbConnectionStringSynonyms.ServerSPN, Keywords.ServerSPN },
{ DbConnectionStringSynonyms.FailoverPartnerSPN, Keywords.FailoverPartnerSPN },
};
Debug.Assert((KeywordsCount + SqlConnectionString.SynonymCount) == pairs.Count, "initial expected size is incorrect");
return pairs;
}
private static bool ConvertToBoolean(object value) => DbConnectionStringBuilderUtil.ConvertToBoolean(value);
private static int ConvertToInt32(object value) => DbConnectionStringBuilderUtil.ConvertToInt32(value);
private static bool ConvertToIntegratedSecurity(object value) => DbConnectionStringBuilderUtil.ConvertToIntegratedSecurity(value);
private static SqlAuthenticationMethod ConvertToAuthenticationType(string keyword, object value) => DbConnectionStringBuilderUtil.ConvertToAuthenticationType(keyword, value);
private static string ConvertToString(object value) => DbConnectionStringBuilderUtil.ConvertToString(value);
private static ApplicationIntent ConvertToApplicationIntent(string keyword, object value) => DbConnectionStringBuilderUtil.ConvertToApplicationIntent(keyword, value);
private static SqlConnectionColumnEncryptionSetting ConvertToColumnEncryptionSetting(string keyword, object value)
=> DbConnectionStringBuilderUtil.ConvertToColumnEncryptionSetting(keyword, value);
private static SqlConnectionAttestationProtocol ConvertToAttestationProtocol(string keyword, object value)
=> DbConnectionStringBuilderUtil.ConvertToAttestationProtocol(keyword, value);
private static SqlConnectionEncryptOption ConvertToSqlConnectionEncryptOption(string keyword, object value)
=> DbConnectionStringBuilderUtil.ConvertToSqlConnectionEncryptOption(keyword, value);
private static SqlConnectionIPAddressPreference ConvertToIPAddressPreference(string keyword, object value)
=> DbConnectionStringBuilderUtil.ConvertToIPAddressPreference(keyword, value);
private static PoolBlockingPeriod ConvertToPoolBlockingPeriod(string keyword, object value)
=> DbConnectionStringBuilderUtil.ConvertToPoolBlockingPeriod(keyword, value);
private object GetAt(Keywords index)
{
switch (index)
{
case Keywords.ApplicationIntent:
return ApplicationIntent;
case Keywords.ApplicationName:
return ApplicationName;
case Keywords.AttachDBFilename:
return AttachDBFilename;
case Keywords.PoolBlockingPeriod:
return PoolBlockingPeriod;
case Keywords.CommandTimeout:
return CommandTimeout;
case Keywords.ConnectTimeout:
return ConnectTimeout;
case Keywords.CurrentLanguage:
return CurrentLanguage;
case Keywords.DataSource:
return DataSource;
case Keywords.Encrypt:
return Encrypt;
case Keywords.HostNameInCertificate:
return HostNameInCertificate;
case Keywords.ServerCertificate:
return ServerCertificate;
case Keywords.Enlist:
return Enlist;
case Keywords.FailoverPartner:
return FailoverPartner;
case Keywords.InitialCatalog:
return InitialCatalog;
case Keywords.IntegratedSecurity:
return IntegratedSecurity;
case Keywords.LoadBalanceTimeout:
return LoadBalanceTimeout;
case Keywords.MultipleActiveResultSets:
return MultipleActiveResultSets;
case Keywords.MaxPoolSize:
return MaxPoolSize;
case Keywords.MinPoolSize:
return MinPoolSize;
case Keywords.MultiSubnetFailover:
return MultiSubnetFailover;
case Keywords.PacketSize:
return PacketSize;
case Keywords.Password:
return Password;
case Keywords.PersistSecurityInfo:
return PersistSecurityInfo;
case Keywords.Pooling:
return Pooling;
case Keywords.Replication:
return Replication;
case Keywords.TransactionBinding:
return TransactionBinding;
case Keywords.TrustServerCertificate:
return TrustServerCertificate;
case Keywords.TypeSystemVersion:
return TypeSystemVersion;
case Keywords.UserID:
return UserID;
case Keywords.UserInstance:
return UserInstance;
case Keywords.WorkstationID:
return WorkstationID;
case Keywords.ConnectRetryCount:
return ConnectRetryCount;
case Keywords.ConnectRetryInterval:
return ConnectRetryInterval;
case Keywords.Authentication:
return Authentication;
case Keywords.ColumnEncryptionSetting:
return ColumnEncryptionSetting;
case Keywords.EnclaveAttestationUrl:
return EnclaveAttestationUrl;
case Keywords.AttestationProtocol:
return AttestationProtocol;
case Keywords.IPAddressPreference:
return IPAddressPreference;
case Keywords.ServerSPN:
return ServerSPN;
case Keywords.FailoverPartnerSPN:
return FailoverPartnerSPN;
#if NETFRAMEWORK
#pragma warning disable 618 // Obsolete properties
case Keywords.ConnectionReset:
return ConnectionReset;
case Keywords.ContextConnection:
return ContextConnection;
#pragma warning restore 618
case Keywords.TransparentNetworkIPResolution:
return TransparentNetworkIPResolution;
case Keywords.NetworkLibrary:
return NetworkLibrary;
#if ADONET_CERT_AUTH
case Keywords.Certificate: return Certificate;
#endif
#endif
default:
Debug.Fail("unexpected keyword");
throw UnsupportedKeyword(s_validKeywords[(int)index]);
}
}
private Keywords GetIndex(string keyword)
{
ADP.CheckArgumentNull(keyword, nameof(keyword));
if (s_keywords.TryGetValue(keyword, out Keywords index))
{
return index;
}
throw UnsupportedKeyword(keyword);
}
private void Reset(Keywords index)
{
switch (index)
{
case Keywords.ApplicationIntent:
_applicationIntent = DbConnectionStringDefaults.ApplicationIntent;
break;
case Keywords.ApplicationName:
_applicationName = DbConnectionStringDefaults.ApplicationName;
break;
case Keywords.AttachDBFilename:
_attachDBFilename = DbConnectionStringDefaults.AttachDBFilename;
break;
case Keywords.Authentication:
_authentication = DbConnectionStringDefaults.Authentication;
break;
case Keywords.PoolBlockingPeriod:
_poolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
break;
case Keywords.CommandTimeout:
_commandTimeout = DbConnectionStringDefaults.CommandTimeout;
break;
case Keywords.ConnectTimeout:
_connectTimeout = DbConnectionStringDefaults.ConnectTimeout;
break;
case Keywords.CurrentLanguage:
_currentLanguage = DbConnectionStringDefaults.CurrentLanguage;
break;
case Keywords.DataSource:
_dataSource = DbConnectionStringDefaults.DataSource;
break;
case Keywords.Encrypt:
_encrypt = DbConnectionStringDefaults.Encrypt;
break;
case Keywords.HostNameInCertificate:
_hostNameInCertificate = DbConnectionStringDefaults.HostNameInCertificate;
break;
case Keywords.ServerCertificate:
_serverCertificate = DbConnectionStringDefaults.ServerCertificate;
break;
case Keywords.Enlist:
_enlist = DbConnectionStringDefaults.Enlist;
break;
case Keywords.FailoverPartner:
_failoverPartner = DbConnectionStringDefaults.FailoverPartner;
break;
case Keywords.InitialCatalog:
_initialCatalog = DbConnectionStringDefaults.InitialCatalog;
break;
case Keywords.IntegratedSecurity:
_integratedSecurity = DbConnectionStringDefaults.IntegratedSecurity;
break;
case Keywords.LoadBalanceTimeout:
_loadBalanceTimeout = DbConnectionStringDefaults.LoadBalanceTimeout;
break;
case Keywords.MultipleActiveResultSets:
_multipleActiveResultSets = DbConnectionStringDefaults.MultipleActiveResultSets;
break;
case Keywords.MaxPoolSize:
_maxPoolSize = DbConnectionStringDefaults.MaxPoolSize;
break;
case Keywords.MinPoolSize:
_minPoolSize = DbConnectionStringDefaults.MinPoolSize;
break;
case Keywords.MultiSubnetFailover:
_multiSubnetFailover = DbConnectionStringDefaults.MultiSubnetFailover;
break;
case Keywords.PacketSize:
_packetSize = DbConnectionStringDefaults.PacketSize;
break;
case Keywords.Password:
_password = DbConnectionStringDefaults.Password;
break;
case Keywords.PersistSecurityInfo:
_persistSecurityInfo = DbConnectionStringDefaults.PersistSecurityInfo;
break;
case Keywords.Pooling:
_pooling = DbConnectionStringDefaults.Pooling;
break;
case Keywords.ConnectRetryCount:
_connectRetryCount = DbConnectionStringDefaults.ConnectRetryCount;
break;
case Keywords.ConnectRetryInterval:
_connectRetryInterval = DbConnectionStringDefaults.ConnectRetryInterval;
break;
case Keywords.Replication:
_replication = DbConnectionStringDefaults.Replication;
break;
case Keywords.TransactionBinding:
_transactionBinding = DbConnectionStringDefaults.TransactionBinding;
break;
case Keywords.TrustServerCertificate:
_trustServerCertificate = DbConnectionStringDefaults.TrustServerCertificate;
break;
case Keywords.TypeSystemVersion:
_typeSystemVersion = DbConnectionStringDefaults.TypeSystemVersion;
break;
case Keywords.UserID:
_userID = DbConnectionStringDefaults.UserID;
break;
case Keywords.UserInstance:
_userInstance = DbConnectionStringDefaults.UserInstance;
break;
case Keywords.WorkstationID:
_workstationID = DbConnectionStringDefaults.WorkstationID;
break;
case Keywords.ColumnEncryptionSetting:
_columnEncryptionSetting = DbConnectionStringDefaults.ColumnEncryptionSetting;
break;
case Keywords.EnclaveAttestationUrl:
_enclaveAttestationUrl = DbConnectionStringDefaults.EnclaveAttestationUrl;
break;
case Keywords.AttestationProtocol:
_attestationProtocol = DbConnectionStringDefaults.AttestationProtocol;
break;
case Keywords.IPAddressPreference:
_ipAddressPreference = DbConnectionStringDefaults.IPAddressPreference;
break;
case Keywords.ServerSPN:
_serverSPN = DbConnectionStringDefaults.ServerSPN;
break;
case Keywords.FailoverPartnerSPN:
_failoverPartnerSPN = DbConnectionStringDefaults.FailoverPartnerSPN;
break;
#if NETFRAMEWORK
case Keywords.ConnectionReset:
_connectionReset = DbConnectionStringDefaults.ConnectionReset;
break;
case Keywords.ContextConnection:
_contextConnection = DbConnectionStringDefaults.ContextConnection;
break;
case Keywords.TransparentNetworkIPResolution:
_transparentNetworkIPResolution = DbConnectionStringDefaults.TransparentNetworkIPResolution;
break;
case Keywords.NetworkLibrary:
_networkLibrary = DbConnectionStringDefaults.NetworkLibrary;
break;
#if ADONET_CERT_AUTH
case Keywords.Certificate:
_certificate = DbConnectionStringDefaults.Certificate;
break;
#endif
#endif
default:
Debug.Fail("unexpected keyword");
throw UnsupportedKeyword(s_validKeywords[(int)index]);
}
}
private void SetValue(string keyword, bool value) => base[keyword] = value.ToString();
private void SetValue(string keyword, int value) => base[keyword] = value.ToString((System.IFormatProvider)null);
private void SetValue(string keyword, string value)
{
ADP.CheckArgumentNull(value, keyword);
base[keyword] = value;
}
private void SetApplicationIntentValue(ApplicationIntent value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidApplicationIntentValue(value), "invalid value for ApplicationIntent");
base[DbConnectionStringKeywords.ApplicationIntent] = DbConnectionStringBuilderUtil.ApplicationIntentToString(value);
}
private void SetColumnEncryptionSettingValue(SqlConnectionColumnEncryptionSetting value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidColumnEncryptionSetting(value), "Invalid value for SqlConnectionColumnEncryptionSetting");
base[DbConnectionStringKeywords.ColumnEncryptionSetting] = DbConnectionStringBuilderUtil.ColumnEncryptionSettingToString(value);
}
private void SetAttestationProtocolValue(SqlConnectionAttestationProtocol value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidAttestationProtocol(value), "Invalid value for SqlConnectionAttestationProtocol");
base[DbConnectionStringKeywords.AttestationProtocol] = DbConnectionStringBuilderUtil.AttestationProtocolToString(value);
}
private void SetSqlConnectionEncryptionValue(SqlConnectionEncryptOption value)
{
base[DbConnectionStringKeywords.Encrypt] = value.ToString();
}
private void SetIPAddressPreferenceValue(SqlConnectionIPAddressPreference value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidIPAddressPreference(value), "Invalid value for SqlConnectionIPAddressPreference");
base[DbConnectionStringKeywords.IPAddressPreference] = DbConnectionStringBuilderUtil.IPAddressPreferenceToString(value);
}
private void SetAuthenticationValue(SqlAuthenticationMethod value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidAuthenticationTypeValue(value), "Invalid value for AuthenticationType");
base[DbConnectionStringKeywords.Authentication] = DbConnectionStringBuilderUtil.AuthenticationTypeToString(value);
}
private void SetPoolBlockingPeriodValue(PoolBlockingPeriod value)
{
Debug.Assert(DbConnectionStringBuilderUtil.IsValidPoolBlockingPeriodValue(value), "Invalid value for PoolBlockingPeriod");
base[DbConnectionStringKeywords.PoolBlockingPeriod] = DbConnectionStringBuilderUtil.PoolBlockingPeriodToString(value);
}
private Exception UnsupportedKeyword(string keyword)
{
#if !NETFRAMEWORK
for (int index = 0; index < s_notSupportedKeywords.Length; index++)
{
if (string.Equals(keyword, s_notSupportedKeywords[index], StringComparison.OrdinalIgnoreCase))
{
return SQL.UnsupportedKeyword(keyword);
}
}
for (int index = 0; index < s_notSupportedNetworkLibraryKeywords.Length; index++)
{
if (string.Equals(keyword, s_notSupportedNetworkLibraryKeywords[index], StringComparison.OrdinalIgnoreCase))
{
return SQL.NetworkLibraryKeywordNotSupported();
}
}
#endif
return ADP.KeywordNotSupported(keyword);
}
private sealed class SqlInitialCatalogConverter : StringConverter
{
// converter classes should have public ctor
public SqlInitialCatalogConverter() { }
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => GetStandardValuesSupportedInternal(context);
private bool GetStandardValuesSupportedInternal(ITypeDescriptorContext context)
{
// Only say standard values are supported if the connection string has enough
// information set to instantiate a connection and retrieve a list of databases
bool flag = false;
if (context is not null)
{
SqlConnectionStringBuilder constr = (context.Instance as SqlConnectionStringBuilder);
if (constr is not null)
{
if ((0 < constr.DataSource.Length) && (constr.IntegratedSecurity || (0 < constr.UserID.Length)))
{
flag = true;
}
}
}
return flag;
}
// Although theoretically this could be true, some people may want to just type in a name
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false;
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
// There can only be standard values if the connection string is in a state that might
// be able to instantiate a connection
if (GetStandardValuesSupportedInternal(context))
{
// Create an array list to store the database names
List<string> values = new List<string>();
try
{
SqlConnectionStringBuilder constr = (SqlConnectionStringBuilder)context.Instance;
// Create a connection
using (SqlConnection connection = new SqlConnection())
{
// Create a basic connection string from current property values
connection.ConnectionString = constr.ConnectionString;
// Try to open the connection
connection.Open();
DataTable databaseTable = connection.GetSchema("DATABASES");
foreach (DataRow row in databaseTable.Rows)
{
string dbName = (string)row["database_name"];
values.Add(dbName);
}
}
}
catch (SqlException e)
{
ADP.TraceExceptionWithoutRethrow(e);
// silently fail
}
// Return values as a StandardValuesCollection
return new StandardValuesCollection(values);
}
return null;
}
}
internal sealed class SqlConnectionStringBuilderConverter : ExpandableObjectConverter
{
// converter classes should have public ctor
public SqlConnectionStringBuilderConverter() { }
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (typeof(InstanceDescriptor) == destinationType)
{
return true;
}
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType is null)
{
throw ADP.ArgumentNull(nameof(destinationType));
}
if (typeof(InstanceDescriptor) == destinationType)
{
SqlConnectionStringBuilder obj = (value as SqlConnectionStringBuilder);
if (obj is not null)
{
return ConvertToInstanceDescriptor(obj);
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
private InstanceDescriptor ConvertToInstanceDescriptor(SqlConnectionStringBuilder options)
{
Type[] ctorParams = new Type[] { typeof(string) };
object[] ctorValues = new object[] { options.ConnectionString };
ConstructorInfo ctor = typeof(SqlConnectionStringBuilder).GetConstructor(ctorParams);
return new InstanceDescriptor(ctor, ctorValues);
}
}
#if NETFRAMEWORK
private sealed class SqlDataSourceConverter : StringConverter
{
private StandardValuesCollection _standardValues;
// converter classes should have public ctor
public SqlDataSourceConverter() { }
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false;
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StandardValuesCollection dataSourceNames = _standardValues;
if (_standardValues is null)
{
// Get the sources rowset for the SQLOLEDB enumerator
DataTable table = SqlClientFactory.Instance.CreateDataSourceEnumerator().GetDataSources();
string ServerName = typeof(System.Data.Sql.SqlDataSourceEnumerator).GetField("ServerName", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null).ToString();
string InstanceName = typeof(System.Data.Sql.SqlDataSourceEnumerator).GetField("InstanceName", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null).ToString();
DataColumn serverName = table.Columns[ServerName];
DataColumn instanceName = table.Columns[InstanceName];
DataRowCollection rows = table.Rows;
string[] serverNames = new string[rows.Count];
for (int i = 0; i < serverNames.Length; ++i)
{
string server = rows[i][serverName] as string;
string instance = rows[i][instanceName] as string;
if ((instance is null) || (0 == instance.Length) || ("MSSQLSERVER" == instance))
{
serverNames[i] = server;
}
else
{
serverNames[i] = server + @"\" + instance;
}
}
Array.Sort<string>(serverNames);
// Create the standard values collection that contains the sources
dataSourceNames = new StandardValuesCollection(serverNames);
_standardValues = dataSourceNames;
}
return dataSourceNames;
}
}
private sealed class NetworkLibraryConverter : TypeConverter
{
// private const string AppleTalk = "Apple Talk (DBMSADSN)"; Invalid protocals
// private const string BanyanVines = "Banyan VINES (DBMSVINN)";
// private const string IPXSPX = "NWLink IPX/SPX (DBMSSPXN)";
// private const string Multiprotocol = "Multiprotocol (DBMSRPCN)";
private const string NamedPipes = "Named Pipes (DBNMPNTW)"; // valid protocols
private const string SharedMemory = "Shared Memory (DBMSLPCN)";
private const string TCPIP = "TCP/IP (DBMSSOCN)";
private const string VIA = "VIA (DBMSGNET)";
// these are correctly non-static, property grid will cache an instance
private StandardValuesCollection _standardValues;
// converter classes should have public ctor
public NetworkLibraryConverter() { }
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
// Only know how to convert from a string
=> (typeof(string) == sourceType) || base.CanConvertFrom(context, sourceType);
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string svalue = (value as string);
if (svalue is not null)
{
svalue = svalue.Trim();
if (StringComparer.OrdinalIgnoreCase.Equals(svalue, NamedPipes))
{
return SqlConnectionString.NETLIB.NamedPipes;
}
else if (StringComparer.OrdinalIgnoreCase.Equals(svalue, SharedMemory))
{
return SqlConnectionString.NETLIB.SharedMemory;
}
else if (StringComparer.OrdinalIgnoreCase.Equals(svalue, TCPIP))
{
return SqlConnectionString.NETLIB.TCPIP;
}
else if (StringComparer.OrdinalIgnoreCase.Equals(svalue, VIA))
{
return SqlConnectionString.NETLIB.VIA;
}
else
{
return svalue;
}
}
return base.ConvertFrom(context, culture, value);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
=> (typeof(string) == destinationType) || base.CanConvertTo(context, destinationType);
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if ((value is string svalue) && (destinationType == typeof(string)))
{
return svalue.Trim().ToLower(CultureInfo.InvariantCulture) switch
{
SqlConnectionString.NETLIB.NamedPipes => NamedPipes,
SqlConnectionString.NETLIB.SharedMemory => SharedMemory,
SqlConnectionString.NETLIB.TCPIP => TCPIP,
SqlConnectionString.NETLIB.VIA => VIA,
_ => svalue,
};
}
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false;
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StandardValuesCollection standardValues = _standardValues;
if (standardValues is null)
{
string[] names = new string[] {
NamedPipes,
SharedMemory,
TCPIP,
VIA,
};
standardValues = new StandardValuesCollection(names);
_standardValues = standardValues;
}
return standardValues;
}
}
#else
private static readonly string[] s_notSupportedKeywords = {
DbConnectionStringKeywords.ConnectionReset,
DbConnectionStringKeywords.ContextConnection,
DbConnectionStringKeywords.TransactionBinding,
DbConnectionStringKeywords.TransparentNetworkIPResolution,
DbConnectionStringSynonyms.TRANSPARENTNETWORKIPRESOLUTION,
};
private static readonly string[] s_notSupportedNetworkLibraryKeywords = {
DbConnectionStringKeywords.NetworkLibrary,
DbConnectionStringSynonyms.NET,
DbConnectionStringSynonyms.NETWORK,
};
#endif
#endregion //Private Methods
#region Public APIs
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/ctor2/*' />
public SqlConnectionStringBuilder() : this(null)
{
}
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/ctorConnectionString/*' />
public SqlConnectionStringBuilder(string connectionString) : base()
{
if (!string.IsNullOrEmpty(connectionString))
{
ConnectionString = connectionString;
}
}
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/Item/*' />
public override object this[string keyword]
{
get => GetAt(GetIndex(keyword));
set
{
if (value is not null)
{
Keywords index = GetIndex(keyword);
switch (index)
{
case Keywords.ApplicationIntent:
ApplicationIntent = ConvertToApplicationIntent(keyword, value);
break;
case Keywords.ApplicationName:
ApplicationName = ConvertToString(value);
break;
case Keywords.AttachDBFilename:
AttachDBFilename = ConvertToString(value);
break;
case Keywords.CurrentLanguage:
CurrentLanguage = ConvertToString(value);
break;
case Keywords.DataSource:
DataSource = ConvertToString(value);
break;
case Keywords.FailoverPartner:
FailoverPartner = ConvertToString(value);
break;
case Keywords.InitialCatalog:
InitialCatalog = ConvertToString(value);
break;
case Keywords.Password:
Password = ConvertToString(value);
break;
case Keywords.UserID:
UserID = ConvertToString(value);
break;
case Keywords.TransactionBinding:
TransactionBinding = ConvertToString(value);
break;
case Keywords.TypeSystemVersion:
TypeSystemVersion = ConvertToString(value);
break;
case Keywords.WorkstationID:
WorkstationID = ConvertToString(value);
break;
case Keywords.CommandTimeout:
CommandTimeout = ConvertToInt32(value);
break;
case Keywords.ConnectTimeout:
ConnectTimeout = ConvertToInt32(value);
break;
case Keywords.LoadBalanceTimeout: