Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / InternalMappingException.cs
1 //---------------------------------------------------------------------
2 // <copyright file="InternalMappingException.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner       Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9
10
11 using System.Data.Common.Utils;
12 using System.Data.Mapping.ViewGeneration.Structures;
13 using System.Runtime.Serialization;
14
15 namespace System.Data {
16
17     /// <summary>
18     /// Mapping exception class. Note that this class has state - so if you change even
19     /// its internals, it can be a breaking change
20     /// </summary>
21     [Serializable]
22     internal class InternalMappingException : EntityException {
23         // effects: constructor with default message
24         #region Constructors
25         /// <summary>
26         /// default constructor
27         /// </summary>
28         internal InternalMappingException() // required ctor
29             : base()
30         {
31         }
32
33         /// <summary>
34         /// default constructor
35         /// </summary>
36         /// <param name="message">localized error message</param>
37         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // required CTOR for exceptions.
38         internal InternalMappingException(string message) // required ctor
39             : base(message)
40         {
41         }
42
43         /// <summary>
44         /// constructor
45         /// </summary>
46         /// <param name="message">localized error message</param>
47         /// <param name="innerException">inner exception</param>
48         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] // required CTOR for exceptions.
49         internal InternalMappingException(string message, Exception innerException) // required ctor
50             : base(message, innerException)
51         {
52         }
53
54         /// <summary>
55         /// constructor
56         /// </summary>
57         /// <param name="info"></param>
58         /// <param name="context"></param>
59         protected InternalMappingException(SerializationInfo info, StreamingContext context) :
60             base(info, context)
61         {
62         }
63
64         // effects: constructor that allows a log
65         internal InternalMappingException(string message, ErrorLog errorLog) : base(message) {
66             EntityUtil.CheckArgumentNull(errorLog, "errorLog");
67             m_errorLog =  errorLog;
68         }
69
70         // effects:  constructor that allows single mapping error
71         internal InternalMappingException(string message, ErrorLog.Record record)
72             : base(message) {
73                 EntityUtil.CheckArgumentNull(record, "record");
74             m_errorLog = new ErrorLog();
75             m_errorLog.AddEntry(record);
76         }
77         #endregion
78
79         #region Fields
80         // Keep track of mapping errors that we want to give to the
81         // user in one shot
82         private ErrorLog m_errorLog;
83         #endregion
84
85         #region Properties
86         /// <summary>
87         /// Returns the inner exceptions stored in this
88         /// </summary>
89         internal ErrorLog ErrorLog {
90             get {
91                 return m_errorLog;
92             }
93         }
94         #endregion
95     }
96 }