コード例 #1
0
 public IEnumerable <string> ETags()
 {
     return(sourceSnapshot.IfNotNull()
            .Then(s => s.ETags)
            .Else(() => new string[0])
            .Concat(eventHistory.Select(e => e.ETag).Distinct()));
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot)
     : this(snapshot.IfNotNull()
            .Then(s => s.AggregateId)
            .ElseThrow(() => new ArgumentNullException(nameof(snapshot))))
 {
     sourceSnapshot = snapshot;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot)
     : this(snapshot.IfNotNull()
                    .Then(s => s.AggregateId)
                    .ElseThrow(() => new ArgumentNullException(nameof(snapshot))))
 {
     sourceSnapshot = snapshot;
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 /// <param name="eventHistory">The event history.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot, IEnumerable <IEvent> eventHistory = null) :
     this(snapshot.IfNotNull()
          .Then(s => s.AggregateId)
          .ElseThrow(() => new ArgumentNullException("snapshot")))
 {
     sourceEvents   = eventHistory.OrEmpty().ToArray();
     sourceSnapshot = snapshot;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 /// <param name="eventHistory">The event history.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot, IEnumerable<IEvent> eventHistory = null) :
     this(snapshot.IfNotNull()
                  .Then(s => s.AggregateId)
                  .ElseThrow(() => new ArgumentNullException("snapshot")))
 {
     sourceEvents = eventHistory.OrEmpty().ToArray();
     SourceSnapshot = snapshot;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 /// <param name="eventHistory">The event history.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot, IEnumerable <IEvent> eventHistory = null)
     : this(snapshot.IfNotNull().Then(s => s.AggregateId).ElseThrow(() => new ArgumentNullException(nameof(snapshot))))
 {
     SourceSnapshot = snapshot;
     InitializeEventHistory(eventHistory.OrEmpty());
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventSourcedAggregate{T}"/> class.
 /// </summary>
 /// <param name="snapshot">A snapshot of the aggregate's built-up state.</param>
 /// <param name="eventHistory">The event history.</param>
 protected internal EventSourcedAggregate(ISnapshot snapshot, IEnumerable<IEvent> eventHistory = null)
     : this(snapshot.IfNotNull().Then(s => s.AggregateId).ElseThrow(() => new ArgumentNullException(nameof(snapshot))))
 {
     SourceSnapshot = snapshot;
     InitializeEventHistory(eventHistory.OrEmpty());
 }