Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.Configuration;
11 : using System.Runtime.Serialization;
12 :
13 : namespace Cqrs.Exceptions
14 : {
15 : /// <summary>
16 : /// A <see cref="ConnectionStringSettings"/> is missing from <see cref="ConfigurationManager.ConnectionStrings"/>.
17 : /// </summary>
18 : [Serializable]
19 : public class MissingConnectionStringException : Exception
20 1 : {
21 :
22 : /// <summary>
23 : /// Instantiate a new instance of <see cref="MissingConnectionStringException"/>.
24 : /// </summary>
25 : /// <param name="connectionStringName">The <see cref="ConnectionStringSettings.Name"/> of the <see cref="ConnectionStringSettings"/> that is missing.</param>
26 1 : public MissingConnectionStringException(string connectionStringName)
27 : : base(string.Format("No connection string named '{0}' was found in the configuration file.", connectionStringName))
28 : {
29 : ConnectionStringName = connectionStringName;
30 : }
31 :
32 : /// <summary>
33 : /// Instantiate a new instance of <see cref="MissingConnectionStringException"/> and a reference to the inner <paramref name="exception"/> that is the cause of this <see cref="Exception"/>.
34 : /// </summary>
35 : /// <param name="connectionStringName">The <see cref="ConnectionStringSettings.Name"/> of the <see cref="ConnectionStringSettings"/> that is missing.</param>
36 : /// <param name="exception">The <see cref="Exception"/> that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner <see cref="Exception"/> is specified.</param>
37 1 : public MissingConnectionStringException(string connectionStringName, Exception exception)
38 : : base(string.Format("No connection string named '{0}' was found in the configuration file.", connectionStringName), exception)
39 : {
40 : ConnectionStringName = connectionStringName;
41 : }
42 :
43 : /// <summary>
44 : /// The <see cref="ConnectionStringSettings.Name"/> of the <see cref="ConnectionStringSettings"/> that is missing.
45 : /// </summary>
46 : [DataMember]
47 : public string ConnectionStringName { get; set; }
48 : }
49 : }
|