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.Runtime.Serialization;
11 : using Cqrs.Commands;
12 :
13 : namespace Cqrs.Domain.Exceptions
14 : {
15 : /// <summary>
16 : /// The operation resulted in a duplicate.
17 : /// </summary>
18 : [Serializable]
19 : public class DuplicateCreateCommandException : Exception
20 1 : {
21 : /// <summary>
22 : /// Instantiate a new instance of <see cref="DuplicateCreateCommandException"/> with a specified <paramref name="message">error message</paramref> and a reference to the inner <paramref name="exception"/> that is the cause of this <see cref="Exception"/>.
23 : /// </summary>
24 : /// <param name="message">The error message that explains the reason for the exception.</param>
25 : /// <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>
26 1 : public DuplicateCreateCommandException(string message, Exception exception)
27 : : base(message, exception)
28 : {
29 : }
30 :
31 : /// <summary>
32 : /// Instantiate a new instance of <see cref="DuplicateCreateCommandException"/> with a reference to the inner <paramref name="exception"/> that is the cause of this <see cref="Exception"/>.
33 : /// </summary>
34 : /// <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>
35 1 : public DuplicateCreateCommandException(Exception exception)
36 : : base("The operation resulted in a duplicate.", exception)
37 : {
38 : }
39 :
40 : /// <summary>
41 : /// Instantiate a new instance of <see cref="DuplicateCreateCommandException"/> with
42 : /// the <paramref name="commandType"/> and <paramref name="commandId"/> that was issued as well as
43 : /// a reference to the inner <paramref name="exception"/> that is the cause of this <see cref="Exception"/>.
44 : /// </summary>
45 : /// <param name="commandType">The <see cref="Type"/> of the <see cref="ICommand{TAuthenticationToken}"/> that was issued.</param>
46 : /// <param name="commandId">The <see cref="ICommand{TAuthenticationToken}.Id"/> of the <see cref="ICommand{TAuthenticationToken}"/> that was issued.</param>
47 : /// <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>
48 1 : public DuplicateCreateCommandException(Type commandType, Guid commandId, Exception exception)
49 : : base(string.Format("The operation resulted in a duplicate for a command of type '{0}' with Rsn '{1}'", commandType.FullName, commandId), exception)
50 : {
51 : CommandType = commandType;
52 : CommandId = commandId;
53 : }
54 :
55 : /// <summary>
56 : /// The <see cref="Type"/> of the <see cref="ICommand{TAuthenticationToken}"/> that was issued.
57 : /// </summary>
58 : [DataMember]
59 : public Type CommandType { get; set; }
60 :
61 : /// <summary>
62 : /// The <see cref="ICommand{TAuthenticationToken}.Id"/> of the <see cref="ICommand{TAuthenticationToken}"/> that was issued.
63 : /// </summary>
64 : [DataMember]
65 : public Guid CommandId { get; set; }
66 : }
67 : }
|