1 //------------------------------------------------------------------------------
2 // <copyright file="StrongTypingException.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
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 {
12 using System.Collections;
14 using System.Runtime.Serialization;
17 /// <para>DEV: The exception that is throwing from strong typed DataSet when user access to DBNull value.</para>
20 public class StrongTypingException : DataException {
21 protected StrongTypingException(SerializationInfo info, StreamingContext context)
22 : base(info, context) {
25 /// <para>[To be supplied.]</para>
27 public StrongTypingException() : base() {
28 HResult = HResults.StrongTyping;
31 public StrongTypingException(string message) : base(message) {
32 HResult = HResults.StrongTyping;
36 /// <para>[To be supplied.]</para>
38 public StrongTypingException(string s, Exception innerException) : base(s, innerException) {
39 HResult = HResults.StrongTyping;
45 /// <para>DEV: The exception that is throwing in generating strong typed DataSet when name conflict happens.</para>
48 public class TypedDataSetGeneratorException : DataException {
49 private ArrayList errorList;
50 private string KEY_ARRAYCOUNT = "KEY_ARRAYCOUNT";
51 private string KEY_ARRAYVALUES = "KEY_ARRAYVALUES";
53 protected TypedDataSetGeneratorException(SerializationInfo info, StreamingContext context)
54 : base(info, context) {
55 int count = (int) info.GetValue(KEY_ARRAYCOUNT, typeof(System.Int32));
57 errorList = new ArrayList();
58 for (int i = 0; i < count; i++) {
59 errorList.Add(info.GetValue(KEY_ARRAYVALUES + i, typeof(System.String)));
67 /// <para>[To be supplied.]</para>
69 public TypedDataSetGeneratorException() : base() {
71 HResult = HResults.StrongTyping;
74 public TypedDataSetGeneratorException(string message) : base(message) {
75 HResult = HResults.StrongTyping;
78 public TypedDataSetGeneratorException(string message, Exception innerException) : base(message, innerException) {
79 HResult = HResults.StrongTyping;
83 /// <para>[To be supplied.]</para>
85 public TypedDataSetGeneratorException(ArrayList list) : this() {
87 HResult = HResults.StrongTyping;
91 /// <para>[To be supplied.]</para>
93 public ArrayList ErrorList {
99 [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
100 public override void GetObjectData(SerializationInfo info, StreamingContext context)
102 base.GetObjectData(info, context);
104 if (errorList != null) {
105 info.AddValue(KEY_ARRAYCOUNT, errorList.Count);
106 for (int i = 0; i < errorList.Count; i++) {
107 info.AddValue(KEY_ARRAYVALUES + i, errorList[i].ToString());
111 info.AddValue(KEY_ARRAYCOUNT, 0);