File: DataException.cs

package info (click to toggle)
mono 6.12.0.199%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,296,836 kB
  • sloc: cs: 11,181,803; xml: 2,850,076; ansic: 699,709; cpp: 123,344; perl: 59,361; javascript: 30,841; asm: 21,853; makefile: 20,405; sh: 15,009; python: 4,839; pascal: 925; sql: 859; sed: 16; php: 1
file content (1479 lines) | stat: -rw-r--r-- 63,500 bytes parent folder | download | duplicates (6)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
//------------------------------------------------------------------------------
// <copyright file="DataException.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
// <owner current="true" primary="false">Microsoft</owner>
//------------------------------------------------------------------------------

namespace System.Data {
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Globalization;
    using System.Runtime.Serialization;

    // Microsoft: This functions are major point of localization.
    // We need to have a rules to enforce consistency there.
    // The dangerous point there are the string arguments of the exported (internal) methods.
    // This string can be argument, table or constraint name but never text of exception itself.
    // Make an invariant that all texts of exceptions coming from resources only.

    [Serializable]
    public class DataException : SystemException {
        protected DataException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public DataException()
        : base(Res.GetString(Res.DataSet_DefaultDataException)) {
            HResult = HResults.Data;
        }

        public DataException(string s)
        : base(s) {
            HResult = HResults.Data;
        }

        public DataException(string s, Exception innerException)
        : base(s, innerException) {
        }

    };

    [Serializable]
    public class ConstraintException : DataException {
        protected ConstraintException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public ConstraintException()         : base(Res.GetString(Res.DataSet_DefaultConstraintException)) {
            HResult = HResults.DataConstraint;
        }
        public ConstraintException(string s) : base(s) {
            HResult = HResults.DataConstraint;
        }

        public ConstraintException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataConstraint;
        }
    }

    [Serializable]
    public class DeletedRowInaccessibleException : DataException {
        protected DeletedRowInaccessibleException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Data.DeletedRowInaccessibleException'/> class.
        ///    </para>
        /// </devdoc>
        public DeletedRowInaccessibleException() : base(Res.GetString(Res.DataSet_DefaultDeletedRowInaccessibleException)) {
            HResult = HResults.DataDeletedRowInaccessible;
        }

        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Data.DeletedRowInaccessibleException'/> class with the specified string.
        ///    </para>
        /// </devdoc>
        public DeletedRowInaccessibleException(string s) : base(s) {
            HResult = HResults.DataDeletedRowInaccessible;
        }

        public DeletedRowInaccessibleException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataDeletedRowInaccessible;
        }
    }

    [Serializable]
    public class DuplicateNameException : DataException {
        protected DuplicateNameException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public DuplicateNameException() : base(Res.GetString(Res.DataSet_DefaultDuplicateNameException)) {
            HResult = HResults.DataDuplicateName;
        }

        public DuplicateNameException(string s) : base(s) {
            HResult = HResults.DataDuplicateName;
        }

        public DuplicateNameException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataDuplicateName;
        }
    }

    [Serializable]
    public class InRowChangingEventException : DataException {
        protected InRowChangingEventException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public InRowChangingEventException() : base(Res.GetString(Res.DataSet_DefaultInRowChangingEventException)) {
            HResult = HResults.DataInRowChangingEvent;
        }

        public InRowChangingEventException(string s) : base(s) {
            HResult = HResults.DataInRowChangingEvent;
        }

        public InRowChangingEventException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataInRowChangingEvent;
        }
    }

    [Serializable]
    public class InvalidConstraintException : DataException {
        protected InvalidConstraintException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public InvalidConstraintException() : base(Res.GetString(Res.DataSet_DefaultInvalidConstraintException)) {
            HResult = HResults.DataInvalidConstraint;
        }

        public InvalidConstraintException(string s) : base(s) {
            HResult = HResults.DataInvalidConstraint;
        }

        public InvalidConstraintException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataInvalidConstraint;
        }
    }

    [Serializable]
    public class MissingPrimaryKeyException : DataException {
        protected MissingPrimaryKeyException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public MissingPrimaryKeyException() : base(Res.GetString(Res.DataSet_DefaultMissingPrimaryKeyException)) {
            HResult = HResults.DataMissingPrimaryKey;
        }

        public MissingPrimaryKeyException(string s) : base(s) {
            HResult = HResults.DataMissingPrimaryKey;
        }

        public MissingPrimaryKeyException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataMissingPrimaryKey;
        }
    }

    [Serializable]
    public class NoNullAllowedException : DataException {
        protected NoNullAllowedException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public NoNullAllowedException() : base(Res.GetString(Res.DataSet_DefaultNoNullAllowedException)) {
            HResult = HResults.DataNoNullAllowed;
        }

        public NoNullAllowedException(string s) : base(s) {
            HResult = HResults.DataNoNullAllowed;
        }

        public NoNullAllowedException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataNoNullAllowed;
        }
    }

    [Serializable]
    public class ReadOnlyException : DataException {
        protected ReadOnlyException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public ReadOnlyException() : base(Res.GetString(Res.DataSet_DefaultReadOnlyException)) {
            HResult = HResults.DataReadOnly;
        }

        public ReadOnlyException(string s) : base(s) {
            HResult = HResults.DataReadOnly;
        }

        public ReadOnlyException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataReadOnly;
        }
    }

    [Serializable]
    public class RowNotInTableException : DataException {
        protected RowNotInTableException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public RowNotInTableException() : base(Res.GetString(Res.DataSet_DefaultRowNotInTableException)) {
            HResult = HResults.DataRowNotInTable;
        }

        public RowNotInTableException(string s) : base(s) {
            HResult = HResults.DataRowNotInTable;
        }

        public RowNotInTableException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataRowNotInTable;
        }
    }

    [Serializable]
    public class VersionNotFoundException : DataException {
        protected VersionNotFoundException(SerializationInfo info, StreamingContext context)
        : base(info, context) {
        }
        public VersionNotFoundException() : base(Res.GetString(Res.DataSet_DefaultVersionNotFoundException)) {
            HResult = HResults.DataVersionNotFound;
        }

        public VersionNotFoundException(string s) : base(s) {
            HResult = HResults.DataVersionNotFound;
        }

        public VersionNotFoundException(string message, Exception innerException)  : base(message, innerException) {
            HResult = HResults.DataVersionNotFound;
        }
    }

    internal static class ExceptionBuilder {
        // The class defines the exceptions that are specific to the DataSet.
        // The class contains functions that take the proper informational variables and then construct
        // the appropriate exception with an error string obtained from the resource Data.txt.
        // The exception is then returned to the caller, so that the caller may then throw from its
        // location so that the catcher of the exception will have the appropriate call stack.
        // This class is used so that there will be compile time checking of error messages.
        // The resource Data.txt will ensure proper string text based on the appropriate
        // locale.

        [BidMethod] // this method accepts BID format as an argument, this attribute allows FXCopBid rule to validate calls to it
        static private void TraceException(
                string trace, 
                [BidArgumentType(typeof(String))] Exception e) {
            Debug.Assert(null != e, "TraceException: null Exception");
            if (null != e) {
                Bid.Trace(trace, e.Message);
                if (Bid.AdvancedOn) {
                    try {
                        Bid.Trace(", StackTrace='%ls'", Environment.StackTrace);
                    }
                    catch(System.Security.SecurityException) {
                        // if you don't have permission - you don't get the stack trace
                    }
                }
                Bid.Trace("\n");
            }
        }

        static internal void TraceExceptionAsReturnValue(Exception e) {
            TraceException("<comm.ADP.TraceException|ERR|THROW> Message='%ls'", e);
        }
        static internal void TraceExceptionForCapture(Exception e) {
            TraceException("<comm.ADP.TraceException|ERR|CATCH> Message='%ls'", e);
        }
        static internal void TraceExceptionWithoutRethrow(Exception e) {
            TraceException("<comm.ADP.TraceException|ERR|CATCH> Message='%ls'", e);
        }

        //
        // COM+ exceptions
        //
        static internal ArgumentException _Argument(string error) {
            ArgumentException e = new ArgumentException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static internal ArgumentException _Argument(string paramName, string error) {
            ArgumentException e = new ArgumentException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static internal ArgumentException _Argument(string error, Exception innerException) {
            ArgumentException e = new ArgumentException(error, innerException);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private ArgumentNullException _ArgumentNull(string paramName, string msg) {
            ArgumentNullException e = new ArgumentNullException(paramName, msg);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static internal ArgumentOutOfRangeException _ArgumentOutOfRange(string paramName, string msg) {
            ArgumentOutOfRangeException e = new ArgumentOutOfRangeException(paramName, msg);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private IndexOutOfRangeException _IndexOutOfRange(string error) {
            IndexOutOfRangeException e = new IndexOutOfRangeException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private InvalidOperationException _InvalidOperation(string error) {
            InvalidOperationException e = new InvalidOperationException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }

        static private InvalidEnumArgumentException _InvalidEnumArgumentException(string error) {
            InvalidEnumArgumentException e = new InvalidEnumArgumentException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }

        static private InvalidEnumArgumentException _InvalidEnumArgumentException<T>(T value) {
            string msg = Res.GetString(Res.ADP_InvalidEnumerationValue, typeof(T).Name, value.ToString());
            return _InvalidEnumArgumentException(msg);
        }

        //
        // System.Data exceptions
        //
        static private DataException _Data(string error) {
            DataException e = new DataException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        /// <summary>trace and throw a DataException</summary>
        /// <param name="error">exception Message</param>
        /// <param name="innerException">exception InnerException</param>
        /// <exception cref="DataException">always thrown</exception>
        static private void ThrowDataException(string error, Exception innerException)
        {
            DataException e = new DataException(error, innerException);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            throw e;
        }
        static private ConstraintException _Constraint(string error) {
            ConstraintException e = new ConstraintException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private InvalidConstraintException _InvalidConstraint(string error) {
            InvalidConstraintException e = new InvalidConstraintException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private DeletedRowInaccessibleException _DeletedRowInaccessible(string error) {
            DeletedRowInaccessibleException e = new DeletedRowInaccessibleException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private DuplicateNameException _DuplicateName(string error) {
            DuplicateNameException e = new DuplicateNameException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private InRowChangingEventException _InRowChangingEvent(string error) {
            InRowChangingEventException e = new InRowChangingEventException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private MissingPrimaryKeyException _MissingPrimaryKey(string error) {
            MissingPrimaryKeyException e = new MissingPrimaryKeyException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private NoNullAllowedException _NoNullAllowed(string error) {
            NoNullAllowedException e = new NoNullAllowedException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private ReadOnlyException _ReadOnly(string error) {
            ReadOnlyException e = new ReadOnlyException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private RowNotInTableException _RowNotInTable(string error) {
            RowNotInTableException e = new RowNotInTableException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }
        static private VersionNotFoundException _VersionNotFound(string error) {
            VersionNotFoundException e = new VersionNotFoundException(error);
            ExceptionBuilder.TraceExceptionAsReturnValue(e);
            return e;
        }


        // Consider: whether we need to keep our own texts from Data_ArgumentNull and Data_ArgumentOutOfRange?
        // Unfortunately ours and the system ones are not consisten between each other. Try to raise this isue in "URT user comunity"
        static public Exception ArgumentNull(string paramName) {
            return _ArgumentNull(paramName, Res.GetString(Res.Data_ArgumentNull, paramName));
        }
        static public Exception ArgumentOutOfRange(string paramName) {
            return _ArgumentOutOfRange(paramName, Res.GetString(Res.Data_ArgumentOutOfRange, paramName));
        }
        static public Exception BadObjectPropertyAccess(string error) {
            return _InvalidOperation(Res.GetString(Res.DataConstraint_BadObjectPropertyAccess, error));
        }
        static public Exception ArgumentContainsNull(string paramName) {
            return _Argument(paramName, Res.GetString(Res.Data_ArgumentContainsNull, paramName));
        }


        //
        // Collections
        //

        static public Exception CannotModifyCollection() {
            return _Argument(Res.GetString(Res.Data_CannotModifyCollection));
        }
        static public Exception CaseInsensitiveNameConflict(string name) {
            return _Argument(Res.GetString(Res.Data_CaseInsensitiveNameConflict, name));
        }
        static public Exception NamespaceNameConflict(string name) {
            return _Argument(Res.GetString(Res.Data_NamespaceNameConflict, name));
        }
        static public Exception InvalidOffsetLength() {
            return _Argument(Res.GetString(Res.Data_InvalidOffsetLength));
        }

        //
        // DataColumnCollection
        //

        static public Exception ColumnNotInTheTable(string column, string table) {
            return _Argument(Res.GetString(Res.DataColumn_NotInTheTable, column, table));
        }

        static public Exception ColumnNotInAnyTable() {
            return _Argument(Res.GetString(Res.DataColumn_NotInAnyTable));
        }

        static public Exception ColumnOutOfRange(int index) {
            return _IndexOutOfRange(Res.GetString(Res.DataColumns_OutOfRange, (index).ToString(CultureInfo.InvariantCulture)));
        }
        static public Exception ColumnOutOfRange(string column) {
            return _IndexOutOfRange(Res.GetString(Res.DataColumns_OutOfRange, column));
        }

        static public Exception CannotAddColumn1(string column) {
            return _Argument(Res.GetString(Res.DataColumns_Add1, column));
        }

        static public Exception CannotAddColumn2(string column) {
            return _Argument(Res.GetString(Res.DataColumns_Add2, column));
        }

        static public Exception CannotAddColumn3() {
            return _Argument(Res.GetString(Res.DataColumns_Add3));
        }

        static public Exception CannotAddColumn4(string column) {
            return _Argument(Res.GetString(Res.DataColumns_Add4, column));
        }

        static public Exception CannotAddDuplicate(string column) {
            return _DuplicateName(Res.GetString(Res.DataColumns_AddDuplicate, column));
        }

        static public Exception CannotAddDuplicate2(string table) {
            return _DuplicateName(Res.GetString(Res.DataColumns_AddDuplicate2, table));
        }

        static public Exception CannotAddDuplicate3(string table) {
            return _DuplicateName(Res.GetString(Res.DataColumns_AddDuplicate3, table));
        }

        static public Exception CannotRemoveColumn() {
            return _Argument(Res.GetString(Res.DataColumns_Remove));
        }

        static public Exception CannotRemovePrimaryKey() {
            return _Argument(Res.GetString(Res.DataColumns_RemovePrimaryKey));
        }

        static public Exception CannotRemoveChildKey(string relation) {
            return _Argument(Res.GetString(Res.DataColumns_RemoveChildKey, relation));
        }

        static public Exception CannotRemoveConstraint(string constraint, string table) {
            return _Argument(Res.GetString(Res.DataColumns_RemoveConstraint, constraint, table));
        }

        static public Exception CannotRemoveExpression(string column, string expression) {
            return _Argument(Res.GetString(Res.DataColumns_RemoveExpression, column, expression));
        }

        static public Exception ColumnNotInTheUnderlyingTable(string column, string table) {
            return _Argument(Res.GetString(Res.DataColumn_NotInTheUnderlyingTable, column, table));
        }

        static public Exception InvalidOrdinal(string name, int ordinal) {
            return _ArgumentOutOfRange(name, Res.GetString(Res.DataColumn_OrdinalExceedMaximun, (ordinal).ToString(CultureInfo.InvariantCulture)));
        }

        //
        // _Constraint and ConstrainsCollection
        //

        static public Exception AddPrimaryKeyConstraint() {
            return _Argument(Res.GetString(Res.DataConstraint_AddPrimaryKeyConstraint));
        }

        static public Exception NoConstraintName() {
            return _Argument(Res.GetString(Res.DataConstraint_NoName));
        }

        static public Exception ConstraintViolation(string constraint) {
            return _Constraint(Res.GetString(Res.DataConstraint_Violation, constraint));
        }

        static public Exception ConstraintNotInTheTable(string constraint) {
            return _Argument(Res.GetString(Res.DataConstraint_NotInTheTable,constraint));
        }

        static public string KeysToString(object[] keys) {
            string values = String.Empty;
            for (int i = 0; i < keys.Length; i++) {
                values += Convert.ToString(keys[i], null) + (i < keys.Length - 1 ? ", " : String.Empty);
            }
            return values;
        }
        static public string UniqueConstraintViolationText(DataColumn[] columns, object[] values) {
            if (columns.Length > 1) {
                string columnNames = String.Empty;
                for (int i = 0; i < columns.Length; i++) {
                    columnNames += columns[i].ColumnName + (i < columns.Length - 1 ? ", " : "");
                }
                return Res.GetString(Res.DataConstraint_ViolationValue, columnNames, KeysToString(values));
            }
            else {
                return Res.GetString(Res.DataConstraint_ViolationValue, columns[0].ColumnName, Convert.ToString(values[0], null));
            }
        }
        static public Exception ConstraintViolation(DataColumn[] columns, object[] values) {
            return _Constraint(UniqueConstraintViolationText(columns, values));
        }

        static public Exception ConstraintOutOfRange(int index) {
            return _IndexOutOfRange(Res.GetString(Res.DataConstraint_OutOfRange, (index).ToString(CultureInfo.InvariantCulture)));
        }

        static public Exception DuplicateConstraint(string constraint) {
            return _Data(Res.GetString(Res.DataConstraint_Duplicate, constraint));
        }

        static public Exception DuplicateConstraintName(string constraint) {
            return _DuplicateName(Res.GetString(Res.DataConstraint_DuplicateName, constraint));
        }

        static public Exception NeededForForeignKeyConstraint(UniqueConstraint key, ForeignKeyConstraint fk) {
            return _Argument(Res.GetString(Res.DataConstraint_NeededForForeignKeyConstraint, key.ConstraintName, fk.ConstraintName));
        }

        static public Exception UniqueConstraintViolation() {
            return _Argument(Res.GetString(Res.DataConstraint_UniqueViolation));
        }

        static public Exception ConstraintForeignTable() {
            return _Argument(Res.GetString(Res.DataConstraint_ForeignTable));
        }

        static public Exception ConstraintParentValues() {
            return _Argument(Res.GetString(Res.DataConstraint_ParentValues));
        }

        static public Exception ConstraintAddFailed(DataTable table) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_AddFailed, table.TableName));
        }

        static public Exception ConstraintRemoveFailed() {
            return _Argument(Res.GetString(Res.DataConstraint_RemoveFailed));
        }

        static public Exception FailedCascadeDelete(string constraint) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_CascadeDelete, constraint));
        }

        static public Exception FailedCascadeUpdate(string constraint) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_CascadeUpdate, constraint));
        }

        static public Exception FailedClearParentTable(string table, string constraint, string childTable) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_ClearParentTable, table, constraint, childTable));
        }

        static public Exception ForeignKeyViolation(string constraint, object[] keys) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_ForeignKeyViolation, constraint, KeysToString(keys)));
        }

        static public Exception RemoveParentRow(ForeignKeyConstraint constraint) {
            return _InvalidConstraint(Res.GetString(Res.DataConstraint_RemoveParentRow, constraint.ConstraintName));
        }

        static public string MaxLengthViolationText(string  columnName) {
            return Res.GetString(Res.DataColumn_ExceedMaxLength, columnName);
        }
        static public string NotAllowDBNullViolationText(string  columnName) {
            return Res.GetString(Res.DataColumn_NotAllowDBNull, columnName);
        }

        static public Exception CantAddConstraintToMultipleNestedTable(string tableName) {
            return _Argument(Res.GetString(Res.DataConstraint_CantAddConstraintToMultipleNestedTable, tableName));
        }

        //
        // DataColumn Set Properties conflicts
        //

        static public Exception AutoIncrementAndExpression() {
            return _Argument(Res.GetString(Res.DataColumn_AutoIncrementAndExpression));
        }
        static public Exception AutoIncrementAndDefaultValue() {
            return _Argument(Res.GetString(Res.DataColumn_AutoIncrementAndDefaultValue));
        }
        static public Exception AutoIncrementSeed() {
            return _Argument(Res.GetString(Res.DataColumn_AutoIncrementSeed));
        }
        static public Exception CantChangeDataType() {
            return _Argument(Res.GetString(Res.DataColumn_ChangeDataType));
        }
        static public Exception NullDataType() {
            return _Argument(Res.GetString(Res.DataColumn_NullDataType));
        }
        static public Exception ColumnNameRequired() {
            return _Argument(Res.GetString(Res.DataColumn_NameRequired));
        }
        static public Exception DefaultValueAndAutoIncrement() {
            return _Argument(Res.GetString(Res.DataColumn_DefaultValueAndAutoIncrement));
        }
        static public Exception DefaultValueDataType(string column, Type defaultType, Type columnType, Exception inner) {
            if (column.Length == 0) {
                return _Argument(Res.GetString(Res.DataColumn_DefaultValueDataType1, defaultType.FullName, columnType.FullName), inner);
            }
            else {
                return _Argument(Res.GetString(Res.DataColumn_DefaultValueDataType, column, defaultType.FullName, columnType.FullName), inner);
            }
        }
        static public Exception DefaultValueColumnDataType(string column, Type defaultType, Type columnType, Exception inner) {
            return _Argument(Res.GetString(Res.DataColumn_DefaultValueColumnDataType, column, defaultType.FullName, columnType.FullName), inner);
        }

        static public Exception ExpressionAndUnique() {
            return _Argument(Res.GetString(Res.DataColumn_ExpressionAndUnique));
        }
        static public Exception ExpressionAndReadOnly() {
            return _Argument(Res.GetString(Res.DataColumn_ExpressionAndReadOnly));
        }

        static public Exception ExpressionAndConstraint(DataColumn column, Constraint constraint) {
            return _Argument(Res.GetString(Res.DataColumn_ExpressionAndConstraint, column.ColumnName, constraint.ConstraintName));
        }

        static public Exception ExpressionInConstraint(DataColumn column) {
            return _Argument(Res.GetString(Res.DataColumn_ExpressionInConstraint, column.ColumnName));
        }

        static public Exception ExpressionCircular() {
            return _Argument(Res.GetString(Res.DataColumn_ExpressionCircular));
        }

        static public Exception NonUniqueValues(string column) {
            return _InvalidConstraint(Res.GetString(Res.DataColumn_NonUniqueValues, column));
        }

        static public Exception NullKeyValues(string column) {
            return _Data(Res.GetString(Res.DataColumn_NullKeyValues, column));
        }
        static public Exception NullValues(string column) {
            return _NoNullAllowed(Res.GetString(Res.DataColumn_NullValues, column));
        }

        static public Exception ReadOnlyAndExpression() {
            return _ReadOnly(Res.GetString(Res.DataColumn_ReadOnlyAndExpression));
        }

        static public Exception ReadOnly(string column) {
            return _ReadOnly(Res.GetString(Res.DataColumn_ReadOnly, column));
        }

        static public Exception UniqueAndExpression() {
            return _Argument(Res.GetString(Res.DataColumn_UniqueAndExpression));
        }

        static public Exception SetFailed(object value, DataColumn column, Type type, Exception innerException) {
            return _Argument(innerException.Message + Res.GetString(Res.DataColumn_SetFailed, value.ToString(), column.ColumnName, type.Name), innerException);
        }

        static public Exception CannotSetToNull(DataColumn column) {
            return _Argument(Res.GetString(Res.DataColumn_CannotSetToNull, column.ColumnName));
        }

        static public Exception LongerThanMaxLength(DataColumn column) {
            return _Argument(Res.GetString(Res.DataColumn_LongerThanMaxLength, column.ColumnName));
        }

        static public Exception CannotSetMaxLength(DataColumn column, int value) {
            return _Argument(Res.GetString(Res.DataColumn_CannotSetMaxLength, column.ColumnName, value.ToString(CultureInfo.InvariantCulture)));
        }

        static public Exception CannotSetMaxLength2(DataColumn column) {
            return _Argument(Res.GetString(Res.DataColumn_CannotSetMaxLength2, column.ColumnName));
        }

        static public Exception CannotSetSimpleContentType(String columnName, Type type) {
            return _Argument(Res.GetString(Res.DataColumn_CannotSimpleContentType, columnName, type));
        }

        static public Exception CannotSetSimpleContent(String columnName, Type type) {
            return _Argument(Res.GetString(Res.DataColumn_CannotSimpleContent, columnName, type));
        }

        static public Exception CannotChangeNamespace(String columnName) {
            return _Argument(Res.GetString(Res.DataColumn_CannotChangeNamespace, columnName));
        }

        static public Exception HasToBeStringType(DataColumn column) {
            return _Argument(Res.GetString(Res.DataColumn_HasToBeStringType, column.ColumnName));
        }

        static public Exception AutoIncrementCannotSetIfHasData(string typeName) {
            return _Argument(Res.GetString(Res.DataColumn_AutoIncrementCannotSetIfHasData, typeName));
        }

        static public Exception INullableUDTwithoutStaticNull(string typeName) {
            return _Argument(Res.GetString( Res.DataColumn_INullableUDTwithoutStaticNull, typeName));
        }

        static public Exception IComparableNotImplemented(string typeName) {
            return _Data(Res.GetString(Res.DataStorage_IComparableNotDefined, typeName));
        }

        static public Exception UDTImplementsIChangeTrackingButnotIRevertible(string typeName) {
            return _InvalidOperation(Res.GetString(Res.DataColumn_UDTImplementsIChangeTrackingButnotIRevertible, typeName));
        }

        static public Exception SetAddedAndModifiedCalledOnnonUnchanged() {
            return _InvalidOperation(Res.GetString(Res.DataColumn_SetAddedAndModifiedCalledOnNonUnchanged));
        }

        static public Exception InvalidDataColumnMapping(Type type) {
            return _Argument(Res.GetString(Res.DataColumn_InvalidDataColumnMapping, type.AssemblyQualifiedName));
        }

        static public Exception CannotSetDateTimeModeForNonDateTimeColumns() {
            return _InvalidOperation(Res.GetString(Res.DataColumn_CannotSetDateTimeModeForNonDateTimeColumns));
        }

        static public Exception InvalidDateTimeMode(DataSetDateTime mode) {
            return _InvalidEnumArgumentException<DataSetDateTime>(mode);
        }

        static public Exception CantChangeDateTimeMode(DataSetDateTime oldValue, DataSetDateTime newValue) {
            return _InvalidOperation(Res.GetString(Res.DataColumn_DateTimeMode, oldValue.ToString(), newValue.ToString()));
        }


        static public Exception ColumnTypeNotSupported() {
            return System.Data.Common.ADP.NotSupported(Res.GetString(Res.DataColumn_NullableTypesNotSupported));
        }

        //
        // DataView
        //

        static public Exception SetFailed(string name) {
            return _Data(Res.GetString(Res.DataView_SetFailed, name));
        }

        static public Exception SetDataSetFailed() {
            return _Data(Res.GetString(Res.DataView_SetDataSetFailed));
        }

        static public Exception SetRowStateFilter() {
            return _Data(Res.GetString(Res.DataView_SetRowStateFilter));
        }

        static public Exception CanNotSetDataSet() {
            return _Data(Res.GetString(Res.DataView_CanNotSetDataSet));
        }

        static public Exception CanNotUseDataViewManager() {
            return _Data(Res.GetString(Res.DataView_CanNotUseDataViewManager));
        }

        static public Exception CanNotSetTable() {
            return _Data(Res.GetString(Res.DataView_CanNotSetTable));
        }

        static public Exception CanNotUse() {
            return _Data(Res.GetString(Res.DataView_CanNotUse));
        }

        static public Exception CanNotBindTable() {
            return _Data(Res.GetString(Res.DataView_CanNotBindTable));
        }

        static public Exception SetTable() {
            return _Data(Res.GetString(Res.DataView_SetTable));
        }

        static public Exception SetIListObject() {
            return _Argument(Res.GetString(Res.DataView_SetIListObject));
        }

        static public Exception AddNewNotAllowNull() {
            return _Data(Res.GetString(Res.DataView_AddNewNotAllowNull));
        }

        static public Exception NotOpen() {
            return _Data(Res.GetString(Res.DataView_NotOpen));
        }

        static public Exception CreateChildView() {
            return _Argument(Res.GetString(Res.DataView_CreateChildView));
        }

        static public Exception CanNotDelete() {
            return _Data(Res.GetString(Res.DataView_CanNotDelete));
        }

        static public Exception CanNotEdit() {
            return _Data(Res.GetString(Res.DataView_CanNotEdit));
        }

        static public Exception GetElementIndex(Int32 index) {
            return _IndexOutOfRange(Res.GetString(Res.DataView_GetElementIndex, (index).ToString(CultureInfo.InvariantCulture)));
        }

        static public Exception AddExternalObject() {
            return _Argument(Res.GetString(Res.DataView_AddExternalObject));
        }

        static public Exception CanNotClear() {
            return _Argument(Res.GetString(Res.DataView_CanNotClear));
        }

        static public Exception InsertExternalObject() {
            return _Argument(Res.GetString(Res.DataView_InsertExternalObject));
        }

        static public Exception RemoveExternalObject() {
            return _Argument(Res.GetString(Res.DataView_RemoveExternalObject));
        }

        static public Exception PropertyNotFound(string property, string table) {
            return _Argument(Res.GetString(Res.DataROWView_PropertyNotFound, property, table));
        }

        static public Exception ColumnToSortIsOutOfRange(string column) {
            return _Argument(Res.GetString(Res.DataColumns_OutOfRange, column));
        }

        //
        // Keys
        //

        static public Exception KeyTableMismatch() {
            return _InvalidConstraint(Res.GetString(Res.DataKey_TableMismatch));
        }

        static public Exception KeyNoColumns() {
            return _InvalidConstraint(Res.GetString(Res.DataKey_NoColumns));
        }

        static public Exception KeyTooManyColumns(int cols) {
            return _InvalidConstraint(Res.GetString(Res.DataKey_TooManyColumns, (cols).ToString(CultureInfo.InvariantCulture)));
        }

        static public Exception KeyDuplicateColumns(string columnName) {
            return _InvalidConstraint(Res.GetString(Res.DataKey_DuplicateColumns, columnName));
        }

        //
        // Relations, constraints
        //

        static public Exception RelationDataSetMismatch() {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_DataSetMismatch));
        }

        static public Exception NoRelationName() {
            return _Argument(Res.GetString(Res.DataRelation_NoName));
        }

        static public Exception ColumnsTypeMismatch() {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_ColumnsTypeMismatch));
        }

        static public Exception KeyLengthMismatch() {
            return _Argument(Res.GetString(Res.DataRelation_KeyLengthMismatch));
        }

        static public Exception KeyLengthZero() {
            return _Argument(Res.GetString(Res.DataRelation_KeyZeroLength));
        }

        static public Exception ForeignRelation() {
            return _Argument(Res.GetString(Res.DataRelation_ForeignDataSet));
        }

        static public Exception KeyColumnsIdentical() {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_KeyColumnsIdentical));
        }

        static public Exception RelationForeignTable(string t1, string t2) {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_ForeignTable, t1, t2));
        }

        static public Exception GetParentRowTableMismatch(string t1, string t2) {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_GetParentRowTableMismatch, t1, t2));
        }

        static public Exception SetParentRowTableMismatch(string t1, string t2) {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_SetParentRowTableMismatch, t1, t2));
        }

        static public Exception RelationForeignRow() {
            return _Argument(Res.GetString(Res.DataRelation_ForeignRow));
        }

        static public Exception RelationNestedReadOnly() {
            return _Argument(Res.GetString(Res.DataRelation_RelationNestedReadOnly));
        }

        static public Exception TableCantBeNestedInTwoTables(string tableName) {
            return _Argument(Res.GetString(Res.DataRelation_TableCantBeNestedInTwoTables, tableName));
        }

        static public Exception LoopInNestedRelations(string tableName) {
            return _Argument(Res.GetString(Res.DataRelation_LoopInNestedRelations, tableName));
        }

        static public Exception RelationDoesNotExist() {
            return _Argument(Res.GetString(Res.DataRelation_DoesNotExist));
        }

        static public Exception ParentRowNotInTheDataSet() {
            return _Argument(Res.GetString(Res.DataRow_ParentRowNotInTheDataSet));
        }

        static public Exception ParentOrChildColumnsDoNotHaveDataSet() {
            return _InvalidConstraint(Res.GetString(Res.DataRelation_ParentOrChildColumnsDoNotHaveDataSet));
        }

        static public Exception InValidNestedRelation(string childTableName) {
            return _InvalidOperation(Res.GetString(Res.DataRelation_InValidNestedRelation, childTableName));
        }


        static public Exception InvalidParentNamespaceinNestedRelation(string childTableName) {
            return _InvalidOperation(Res.GetString(Res.DataRelation_InValidNamespaceInNestedRelation, childTableName));
        }

        //
        // Rows
        //

        static public Exception RowNotInTheDataSet() {
            return _Argument(Res.GetString(Res.DataRow_NotInTheDataSet));
        }

        static public Exception RowNotInTheTable() {
            return _RowNotInTable(Res.GetString(Res.DataRow_NotInTheTable));
        }
        static public Exception EditInRowChanging() {
            return _InRowChangingEvent(Res.GetString(Res.DataRow_EditInRowChanging));
        }

        static public Exception EndEditInRowChanging() {
            return _InRowChangingEvent(Res.GetString(Res.DataRow_EndEditInRowChanging));
        }

        static public Exception BeginEditInRowChanging() {
            return _InRowChangingEvent(Res.GetString(Res.DataRow_BeginEditInRowChanging));
        }

        static public Exception CancelEditInRowChanging() {
            return _InRowChangingEvent(Res.GetString(Res.DataRow_CancelEditInRowChanging));
        }

        static public Exception DeleteInRowDeleting() {
            return _InRowChangingEvent(Res.GetString(Res.DataRow_DeleteInRowDeleting));
        }

        static public Exception ValueArrayLength() {
            return _Argument(Res.GetString(Res.DataRow_ValuesArrayLength));
        }

        static public Exception NoCurrentData() {
            return _VersionNotFound(Res.GetString(Res.DataRow_NoCurrentData));
        }

        static public Exception NoOriginalData() {
            return _VersionNotFound(Res.GetString(Res.DataRow_NoOriginalData));
        }

        static public Exception NoProposedData() {
            return _VersionNotFound(Res.GetString(Res.DataRow_NoProposedData));
        }

        static public Exception RowRemovedFromTheTable() {
            return _RowNotInTable(Res.GetString(Res.DataRow_RemovedFromTheTable));
        }

        static public Exception DeletedRowInaccessible() {
            return _DeletedRowInaccessible(Res.GetString(Res.DataRow_DeletedRowInaccessible));
        }

        static public Exception RowAlreadyDeleted() {
            return _DeletedRowInaccessible(Res.GetString(Res.DataRow_AlreadyDeleted));
        }

        static public Exception RowEmpty() {
            return _Argument(Res.GetString(Res.DataRow_Empty));
        }

        static public Exception InvalidRowVersion() {
            return _Data(Res.GetString(Res.DataRow_InvalidVersion));
        }

        static public Exception RowOutOfRange() {
            return _IndexOutOfRange(Res.GetString(Res.DataRow_RowOutOfRange));
        }
        static public Exception RowOutOfRange(int index) {
            return _IndexOutOfRange(Res.GetString(Res.DataRow_OutOfRange, (index).ToString(CultureInfo.InvariantCulture)));
        }
        static public Exception RowInsertOutOfRange(int index) {
            return _IndexOutOfRange(Res.GetString(Res.DataRow_RowInsertOutOfRange, (index).ToString(CultureInfo.InvariantCulture)));
        }

        static public Exception RowInsertTwice(int index, string tableName) {
            return _IndexOutOfRange(Res.GetString(Res.DataRow_RowInsertTwice, (index).ToString(CultureInfo.InvariantCulture), tableName));
        }

        static public Exception RowInsertMissing( string tableName) {
            return _IndexOutOfRange(Res.GetString(Res.DataRow_RowInsertMissing, tableName));
        }

        static public Exception RowAlreadyRemoved() {
            return _Data(Res.GetString(Res.DataRow_AlreadyRemoved));
        }

        static public Exception MultipleParents() {
            return _Data(Res.GetString(Res.DataRow_MultipleParents));
        }

        static public Exception InvalidRowState(DataRowState state) {
            return _InvalidEnumArgumentException<DataRowState>(state);
        }

        static public Exception InvalidRowBitPattern() {
            return _Argument(Res.GetString(Res.DataRow_InvalidRowBitPattern));
        }

        //
        // DataSet
        //

        static internal Exception SetDataSetNameToEmpty() {
            return _Argument(Res.GetString(Res.DataSet_SetNameToEmpty));
        }
        static internal Exception SetDataSetNameConflicting(string name) {
            return _Argument(Res.GetString(Res.DataSet_SetDataSetNameConflicting, name));
        }
        static public Exception DataSetUnsupportedSchema(string ns) {
            return _Argument(Res.GetString(Res.DataSet_UnsupportedSchema, ns));
        }
        static public Exception MergeMissingDefinition(string obj) {
            return _Argument(Res.GetString(Res.DataMerge_MissingDefinition, obj));
        }
        static public Exception TablesInDifferentSets() {
            return _Argument(Res.GetString(Res.DataRelation_TablesInDifferentSets));
        }
        static public Exception RelationAlreadyExists() {
            return _Argument(Res.GetString(Res.DataRelation_AlreadyExists));
        }
        static public Exception RowAlreadyInOtherCollection() {
            return _Argument(Res.GetString(Res.DataRow_AlreadyInOtherCollection));
        }
        static public Exception RowAlreadyInTheCollection() {
            return _Argument(Res.GetString(Res.DataRow_AlreadyInTheCollection));
        }
        static public Exception TableMissingPrimaryKey() {
            return _MissingPrimaryKey(Res.GetString(Res.DataTable_MissingPrimaryKey));
        }
        static public Exception RecordStateRange() {
            return _Argument(Res.GetString(Res.DataIndex_RecordStateRange));
        }
        static public Exception IndexKeyLength(int length, int keyLength) {
            if(length == 0) {
                return _Argument(Res.GetString(Res.DataIndex_FindWithoutSortOrder));
            }
            else {
                return _Argument(Res.GetString(Res.DataIndex_KeyLength, (length).ToString(CultureInfo.InvariantCulture), (keyLength).ToString(CultureInfo.InvariantCulture)));
            }
        }

        static public Exception RemovePrimaryKey(DataTable table) {
            if (table.TableName.Length == 0) {
                return _Argument(Res.GetString(Res.DataKey_RemovePrimaryKey));
            }
            else {
                return _Argument(Res.GetString(Res.DataKey_RemovePrimaryKey1, table.TableName));
            }
        }
        static public Exception RelationAlreadyInOtherDataSet() {
            return _Argument(Res.GetString(Res.DataRelation_AlreadyInOtherDataSet));
        }
        static public Exception RelationAlreadyInTheDataSet() {
            return _Argument(Res.GetString(Res.DataRelation_AlreadyInTheDataSet));
        }
        static public Exception RelationNotInTheDataSet(string relation) {
            return _Argument(Res.GetString(Res.DataRelation_NotInTheDataSet,relation));
        }
        static public Exception RelationOutOfRange(object index) {
            return _IndexOutOfRange(Res.GetString(Res.DataRelation_OutOfRange, Convert.ToString(index, null)));
        }
        static public Exception DuplicateRelation(string relation) {
            return _DuplicateName(Res.GetString(Res.DataRelation_DuplicateName, relation));
        }
        static public Exception RelationTableNull() {
            return _Argument(Res.GetString(Res.DataRelation_TableNull));
        }
        static public Exception RelationDataSetNull() {
            return _Argument(Res.GetString(Res.DataRelation_TableNull));
        }
        static public Exception RelationTableWasRemoved() {
            return _Argument(Res.GetString(Res.DataRelation_TableWasRemoved));
        }
        static public Exception ParentTableMismatch() {
            return _Argument(Res.GetString(Res.DataRelation_ParentTableMismatch));
        }
        static public Exception ChildTableMismatch() {
            return _Argument(Res.GetString(Res.DataRelation_ChildTableMismatch));
        }
        static public Exception EnforceConstraint() {
            return _Constraint(Res.GetString(Res.Data_EnforceConstraints));
        }
        static public Exception CaseLocaleMismatch() {
            return _Argument(Res.GetString(Res.DataRelation_CaseLocaleMismatch));
        }
        static public Exception CannotChangeCaseLocale() {
            return CannotChangeCaseLocale(null);
        }
        static public Exception CannotChangeCaseLocale(Exception innerException) {
            return _Argument(Res.GetString(Res.DataSet_CannotChangeCaseLocale), innerException);
        }

        static public Exception CannotChangeSchemaSerializationMode() {
            return _InvalidOperation(Res.GetString(Res.DataSet_CannotChangeSchemaSerializationMode));
        }

        static public Exception InvalidSchemaSerializationMode(Type enumType, string mode) {
            return _InvalidEnumArgumentException(Res.GetString(Res.ADP_InvalidEnumerationValue, enumType.Name, mode));
        }

        static public Exception InvalidRemotingFormat(SerializationFormat mode) {
#if DEBUG
            switch(mode) {
            case SerializationFormat.Xml:
            case SerializationFormat.Binary:
                Debug.Assert(false, "valid SerializationFormat " + mode.ToString());
                break;
            }
#endif
            return _InvalidEnumArgumentException<SerializationFormat>(mode);
        }

        //
        // DataTable and DataTableCollection
        //
        static public Exception TableForeignPrimaryKey() {
            return _Argument(Res.GetString(Res.DataTable_ForeignPrimaryKey));
        }
        static public Exception TableCannotAddToSimpleContent() {
            return _Argument(Res.GetString(Res.DataTable_CannotAddToSimpleContent));
        }
        static public Exception NoTableName() {
            return _Argument(Res.GetString(Res.DataTable_NoName));
        }
        static public Exception MultipleTextOnlyColumns() {
            return _Argument(Res.GetString(Res.DataTable_MultipleSimpleContentColumns));
        }
        static public Exception InvalidSortString(string sort) {
            return _Argument(Res.GetString(Res.DataTable_InvalidSortString, sort));
        }
        static public Exception DuplicateTableName(string table) {
            return _DuplicateName(Res.GetString(Res.DataTable_DuplicateName, table));
        }
        static public Exception DuplicateTableName2(string table, string ns) {
            return _DuplicateName(Res.GetString(Res.DataTable_DuplicateName2, table, ns));
        }
        static public Exception SelfnestedDatasetConflictingName(string table) {
            return _DuplicateName(Res.GetString(Res.DataTable_SelfnestedDatasetConflictingName, table));
        }
        static public Exception DatasetConflictingName(string table) {
            return _DuplicateName(Res.GetString(Res.DataTable_DatasetConflictingName, table));
        }
        static public Exception TableAlreadyInOtherDataSet() {
            return _Argument(Res.GetString(Res.DataTable_AlreadyInOtherDataSet));
        }
        static public Exception TableAlreadyInTheDataSet() {
            return _Argument(Res.GetString(Res.DataTable_AlreadyInTheDataSet));
        }
        static public Exception TableOutOfRange(int index) {
            return _IndexOutOfRange(Res.GetString(Res.DataTable_OutOfRange, (index).ToString(CultureInfo.InvariantCulture)));
        }
        static public Exception TableNotInTheDataSet(string table) {
            return _Argument(Res.GetString(Res.DataTable_NotInTheDataSet, table));
        }
        static public Exception TableInRelation() {
            return _Argument(Res.GetString(Res.DataTable_InRelation));
        }
        static public Exception TableInConstraint(DataTable table, Constraint constraint) {
            return _Argument(Res.GetString(Res.DataTable_InConstraint, table.TableName, constraint.ConstraintName));
        }

        static public Exception CanNotSerializeDataTableHierarchy() {
            return _InvalidOperation(Res.GetString(Res.DataTable_CanNotSerializeDataTableHierarchy));
        }

        static public Exception CanNotRemoteDataTable() {
            return _InvalidOperation(Res.GetString(Res.DataTable_CanNotRemoteDataTable));
        }

        static public Exception CanNotSetRemotingFormat() {
            return _Argument(Res.GetString(Res.DataTable_CanNotSetRemotingFormat));
        }

        static public Exception CanNotSerializeDataTableWithEmptyName() {
            return _InvalidOperation(Res.GetString(Res.DataTable_CanNotSerializeDataTableWithEmptyName));
        }

        static public Exception TableNotFound (string tableName) {
            return _Argument(Res.GetString(Res.DataTable_TableNotFound, tableName));
        }


        //
        // Storage
        //
        static public Exception AggregateException(AggregateType aggregateType, Type type) {
            return _Data(Res.GetString(Res.DataStorage_AggregateException, aggregateType.ToString(), type.Name));
        }
        static public Exception InvalidStorageType(TypeCode typecode) {
            return _Data(Res.GetString(Res.DataStorage_InvalidStorageType, ((Enum) typecode).ToString()));
        }

        static public Exception RangeArgument(Int32 min, Int32 max) {
            return _Argument(Res.GetString(Res.Range_Argument, (min).ToString(CultureInfo.InvariantCulture), (max).ToString(CultureInfo.InvariantCulture)));
        }
        static public Exception NullRange() {
            return _Data(Res.GetString(Res.Range_NullRange));
        }
        static public Exception NegativeMinimumCapacity() {
            return _Argument(Res.GetString(Res.RecordManager_MinimumCapacity));
        }
        static public Exception ProblematicChars(char charValue) {
            string xchar = "0x" + ((UInt16)charValue).ToString("X", CultureInfo.InvariantCulture);
            return _Argument(Res.GetString(Res.DataStorage_ProblematicChars, xchar));
        }

        static public Exception StorageSetFailed() {
            return _Argument(Res.GetString(Res.DataStorage_SetInvalidDataType));
        }


        //
        // XML schema
        //
        static public Exception SimpleTypeNotSupported() {
            return _Data(Res.GetString(Res.Xml_SimpleTypeNotSupported));
        }

        static public Exception MissingAttribute(string attribute) {
            return MissingAttribute(String.Empty, attribute);
        }

        static public Exception MissingAttribute(string element, string attribute) {
            return _Data(Res.GetString(Res.Xml_MissingAttribute, element, attribute));
        }

        static public Exception InvalidAttributeValue(string name, string value) {
            return _Data(Res.GetString(Res.Xml_ValueOutOfRange, name, value));
        }

        static public Exception AttributeValues(string name, string value1, string value2) {
            return _Data(Res.GetString(Res.Xml_AttributeValues, name, value1, value2));
        }

        static public Exception ElementTypeNotFound(string name) {
            return _Data(Res.GetString(Res.Xml_ElementTypeNotFound, name));
        }

        static public Exception RelationParentNameMissing(string rel) {
            return _Data(Res.GetString(Res.Xml_RelationParentNameMissing, rel));
        }

        static public Exception RelationChildNameMissing(string rel) {
            return _Data(Res.GetString(Res.Xml_RelationChildNameMissing, rel));
        }

        static public Exception RelationTableKeyMissing(string rel) {
            return _Data(Res.GetString(Res.Xml_RelationTableKeyMissing, rel));
        }

        static public Exception RelationChildKeyMissing(string rel) {
            return _Data(Res.GetString(Res.Xml_RelationChildKeyMissing, rel));
        }

        static public Exception UndefinedDatatype(string name) {
            return _Data(Res.GetString(Res.Xml_UndefinedDatatype, name));
        }

        static public Exception DatatypeNotDefined() {
            return _Data(Res.GetString(Res.Xml_DatatypeNotDefined));
        }

        static public Exception MismatchKeyLength() {
            return _Data(Res.GetString(Res.Xml_MismatchKeyLength));
        }

        static public Exception InvalidField(string name) {
            return _Data(Res.GetString(Res.Xml_InvalidField, name));
        }

        static public Exception InvalidSelector(string name) {
            return _Data(Res.GetString(Res.Xml_InvalidSelector, name));
        }

        static public Exception CircularComplexType(string name) {
            return _Data(Res.GetString(Res.Xml_CircularComplexType, name));
        }

        static public Exception CannotInstantiateAbstract(string name) {
            return _Data(Res.GetString(Res.Xml_CannotInstantiateAbstract, name));
        }

        static public Exception InvalidKey(string name) {
            return _Data(Res.GetString(Res.Xml_InvalidKey, name));
        }

        static public Exception DiffgramMissingTable(string name) {
            return _Data(Res.GetString(Res.Xml_MissingTable, name));
        }

        static public Exception DiffgramMissingSQL() {
            return _Data(Res.GetString(Res.Xml_MissingSQL));
        }

        static public Exception DuplicateConstraintRead(string str) {
            return _Data(Res.GetString(Res.Xml_DuplicateConstraint, str));
        }

        static public Exception ColumnTypeConflict(string name) {
            return _Data(Res.GetString(Res.Xml_ColumnConflict, name));
        }

        static public Exception CannotConvert(string name, string type) {
            return _Data(Res.GetString(Res.Xml_CannotConvert, name, type));
        }

        static public Exception MissingRefer(string name) {
            return _Data(Res.GetString(Res.Xml_MissingRefer, Keywords.REFER, Keywords.XSD_KEYREF, name));
        }

        static public Exception InvalidPrefix(string name) {
            return _Data(Res.GetString(Res.Xml_InvalidPrefix, name));
        }

        static public Exception CanNotDeserializeObjectType() {
            return _InvalidOperation(Res.GetString(Res.Xml_CanNotDeserializeObjectType));
        }

        static public Exception IsDataSetAttributeMissingInSchema() {
            return _Data(Res.GetString(Res.Xml_IsDataSetAttributeMissingInSchema));
        }
        static public Exception TooManyIsDataSetAtributeInSchema() {
            return _Data(Res.GetString(Res.Xml_TooManyIsDataSetAtributeInSchema));
        }

        // XML save
        static public Exception NestedCircular(string name) {
            return _Data(Res.GetString(Res.Xml_NestedCircular, name));
        }

        static public Exception MultipleParentRows(string tableQName) {
            return _Data(Res.GetString(Res.Xml_MultipleParentRows, tableQName));
        }

        static public Exception PolymorphismNotSupported(string typeName) {
            return _InvalidOperation(Res.GetString(Res.Xml_PolymorphismNotSupported, typeName));
        }


        static public Exception DataTableInferenceNotSupported() {
            return _InvalidOperation(Res.GetString(Res.Xml_DataTableInferenceNotSupported));
        }

        /// <summary>throw DataException for multitarget failure</summary>
        /// <param name="innerException">exception from multitarget converter</param>
        /// <exception cref="DataException">always thrown</exception>
        static internal void ThrowMultipleTargetConverter(Exception innerException)
        {
            string res = (null != innerException) ? Res.Xml_MultipleTargetConverterError : Res.Xml_MultipleTargetConverterEmpty;
            ThrowDataException(Res.GetString(res), innerException);
        }

        //
        // Merge
        //
        static public Exception DuplicateDeclaration(string name) {
            return _Data(Res.GetString(Res.Xml_MergeDuplicateDeclaration, name));
        }


        //Read Xml data
        static public Exception FoundEntity() {
            return _Data(Res.GetString(Res.Xml_FoundEntity));
        }

        // ATTENTION: name has to be localized string here:
        static public Exception MergeFailed(string name) {
            return _Data(name);
        }

        // SqlConvert
        static public DataException ConvertFailed(Type type1, Type type2) {
            return _Data(Res.GetString(Res.SqlConvert_ConvertFailed, type1.FullName, type2.FullName));
        }

        // DataTableReader
        static public Exception InvalidDataTableReader(string tableName) {
            return _InvalidOperation(Res.GetString(Res.DataTableReader_InvalidDataTableReader, tableName));
        }

        static public Exception DataTableReaderSchemaIsInvalid(string tableName) {
            return _InvalidOperation(Res.GetString(Res.DataTableReader_SchemaInvalidDataTableReader, tableName));
        }

        static public Exception CannotCreateDataReaderOnEmptyDataSet() {
            return _Argument(Res.GetString(Res.DataTableReader_CannotCreateDataReaderOnEmptyDataSet));
        }

        static public Exception DataTableReaderArgumentIsEmpty() {
            return _Argument(Res.GetString(Res.DataTableReader_DataTableReaderArgumentIsEmpty));
        }

        static public Exception ArgumentContainsNullValue() {
            return _Argument(Res.GetString(Res.DataTableReader_ArgumentContainsNullValue));
        }

        static public Exception InvalidCurrentRowInDataTableReader() {
            return _DeletedRowInaccessible(Res.GetString(Res.DataTableReader_InvalidRowInDataTableReader));
        }

        static public Exception EmptyDataTableReader(string tableName) {
            return _DeletedRowInaccessible(Res.GetString(Res.DataTableReader_DataTableCleared, tableName));
        }


        //
        static internal Exception InvalidDuplicateNamedSimpleTypeDelaration(string stName, string errorStr) {
            return _Argument(Res.GetString(Res.NamedSimpleType_InvalidDuplicateNamedSimpleTypeDelaration, stName, errorStr));
        }

        // RbTree
        static internal Exception InternalRBTreeError(RBTreeError internalError) {
            return _InvalidOperation(Res.GetString(Res.RbTree_InvalidState, (int)internalError));
        }
        static public Exception EnumeratorModified() {
            return _InvalidOperation(Res.GetString(Res.RbTree_EnumerationBroken));
        }
    }// ExceptionBuilder
}