Exemplo n.º 1
0
 public static void NotDefault(EventStreamId value, string paramName)
 {
     if (value.IsDefault)
     {
         throw new ArgumentException("Must not be default.", paramName);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventStreamInfo"/> class.
        /// </summary>
        /// <param name="id">The stream identifier.</param>
        /// <param name="sequence">The current sequence number.</param>
        /// <param name="count">The current number of events.</param>
        /// <param name="sealed">The sealed status of the stream.</param>
        /// <exception cref="ArgumentException"><paramref name="id"/> is default.</exception>
        public EventStreamInfo(EventStreamId id, long sequence, long count, bool @sealed)
        {
            Requires.NotDefault(id, nameof(id));

            Id       = id;
            Sequence = sequence;
            Count    = count;
            Sealed   = @sealed;
        }
Exemplo n.º 3
0
        /// <summary>
        /// A synchronous <see cref="IEventStreamHost{T}.GetAsync"/>.
        /// </summary>
        public static IEventStream <T> Get <T>(this IEventStreamHost <T> host, EventStreamId id)
        {
            Requires.NotNull(host, nameof(host));

            return(host.GetAsync(id).GetResult());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStreamSequenceNotFoundException"/> class.
 /// </summary>
 /// <param name="id">The identifier of the stream.</param>
 /// <param name="sequence">The sequence.</param>
 /// <exception cref="ArgumentException"><paramref name="id"/> is default.</exception>
 public EventStreamSequenceNotFoundException(EventStreamId id, long sequence)
     : base($"The sequence {sequence} was not found in the stream with the identifier '{id}'.")
 {
     Requires.NotDefault(id, nameof(id));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStreamAlreadyExistsException"/> class.
 /// </summary>
 /// <param name="id">The identifier of the stream.</param>
 /// <exception cref="ArgumentException"><paramref name="id"/> is default.</exception>
 public EventStreamAlreadyExistsException(EventStreamId id)
     : base($"A stream with the identifier '{id}' already exists.")
 {
     Requires.NotDefault(id, nameof(id));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStreamSealedException"/> class.
 /// </summary>
 /// <param name="id">The identifier of the stream.</param>
 /// <exception cref="ArgumentException"><paramref name="id"/> is default.</exception>
 public EventStreamSealedException(EventStreamId id)
     : base($"The stream with the identifier '{id}' has been sealed.")
 {
     Requires.NotDefault(id, nameof(id));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventStreamNotFoundException"/> class.
 /// </summary>
 /// <param name="id">The identifier of the stream.</param>
 /// <exception cref="ArgumentException"><paramref name="id"/> is default.</exception>
 public EventStreamNotFoundException(EventStreamId id)
     : base($"A stream with the identifier '{id}' was not found.")
 {
     Requires.NotDefault(id, nameof(id));
 }