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.Events;
12 :
13 : namespace Cqrs.Domain.Exceptions
14 : {
15 : /// <summary>
16 : /// An <see cref="IEvent{TAuthenticationToken}"/> was processed out of order or an expected <see cref="IEvent{TAuthenticationToken}"/> was not found.
17 : /// </summary>
18 : [Serializable]
19 : public class ConcurrencyException : Exception
20 1 : {
21 : /// <summary>
22 : /// Instantiate a new instance of <see cref="ConcurrencyException"/> with the provided identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had a concurrency issue.
23 : /// </summary>
24 : /// <param name="id">The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that wasn't found.</param>
25 1 : public ConcurrencyException(Guid id)
26 : : base(string.Format("A different version than expected was found in aggregate {0}", id))
27 : {
28 : Id = id;
29 : }
30 :
31 : /// <summary>
32 : /// The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> that had a concurrency issue.
33 : /// </summary>
34 : [DataMember]
35 : public Guid Id { get; set; }
36 : }
37 : }
|