[System.Data] referencesource -> corefx: ProviderBase & SqlClient stuff (#4383)
[mono-project.git] / mcs / class / referencesource / System.Data / System / Data / CodeGen / StrongTypingException.cs
blob7fcf6f07ab366112bb4c983199863ae276f13591
1 //------------------------------------------------------------------------------
2 // <copyright file="StrongTypingException.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">[....]</owner>
6 // <owner current="true" primary="false">[....]</owner>
7 // <owner current="false" primary="false">[....]</owner>
8 //------------------------------------------------------------------------------
10 namespace System.Data {
11 using System;
12 using System.Collections;
13 using System.Data;
14 using System.Runtime.Serialization;
16 #if !COREFX
17 /// <devdoc>
18 /// <para>DEV: The exception that is throwing from strong typed DataSet when user access to DBNull value.</para>
19 /// </devdoc>
20 [Serializable]
21 public class StrongTypingException : DataException {
22 protected StrongTypingException(SerializationInfo info, StreamingContext context)
23 : base(info, context) {
25 /// <devdoc>
26 /// <para>[To be supplied.]</para>
27 /// </devdoc>
28 public StrongTypingException() : base() {
29 HResult = HResults.StrongTyping;
32 public StrongTypingException(string message) : base(message) {
33 HResult = HResults.StrongTyping;
36 /// <devdoc>
37 /// <para>[To be supplied.]</para>
38 /// </devdoc>
39 public StrongTypingException(string s, Exception innerException) : base(s, innerException) {
40 HResult = HResults.StrongTyping;
43 #endif
45 /// <devdoc>
46 /// <para>DEV: The exception that is throwing in generating strong typed DataSet when name conflict happens.</para>
47 /// </devdoc>
48 [Serializable]
49 public class TypedDataSetGeneratorException : DataException {
50 private ArrayList errorList;
51 private string KEY_ARRAYCOUNT = "KEY_ARRAYCOUNT";
52 private string KEY_ARRAYVALUES = "KEY_ARRAYVALUES";
54 protected TypedDataSetGeneratorException(SerializationInfo info, StreamingContext context)
55 : base(info, context) {
56 int count = (int) info.GetValue(KEY_ARRAYCOUNT, typeof(System.Int32));
57 if (count > 0) {
58 errorList = new ArrayList();
59 for (int i = 0; i < count; i++) {
60 errorList.Add(info.GetValue(KEY_ARRAYVALUES + i, typeof(System.String)));
63 else
64 errorList = null;
67 /// <devdoc>
68 /// <para>[To be supplied.]</para>
69 /// </devdoc>
70 public TypedDataSetGeneratorException() : base() {
71 errorList = null;
72 HResult = HResults.StrongTyping;
75 public TypedDataSetGeneratorException(string message) : base(message) {
76 HResult = HResults.StrongTyping;
79 public TypedDataSetGeneratorException(string message, Exception innerException) : base(message, innerException) {
80 HResult = HResults.StrongTyping;
83 /// <devdoc>
84 /// <para>[To be supplied.]</para>
85 /// </devdoc>
86 public TypedDataSetGeneratorException(ArrayList list) : this() {
87 errorList = list;
88 HResult = HResults.StrongTyping;
91 /// <devdoc>
92 /// <para>[To be supplied.]</para>
93 /// </devdoc>
94 public ArrayList ErrorList {
95 get {
96 return errorList;
100 [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
101 public override void GetObjectData(SerializationInfo info, StreamingContext context)
103 base.GetObjectData(info, context);
105 if (errorList != null) {
106 info.AddValue(KEY_ARRAYCOUNT, errorList.Count);
107 for (int i = 0; i < errorList.Count; i++) {
108 info.AddValue(KEY_ARRAYVALUES + i, errorList[i].ToString());
111 else {
112 info.AddValue(KEY_ARRAYCOUNT, 0);