|
| 1 | +using System; |
| 2 | + |
| 3 | +namespace StreamSource.Storage |
| 4 | +{ |
| 5 | + public class StreamRecord |
| 6 | + { |
| 7 | + public readonly byte[] StreamId; |
| 8 | + public readonly int StreamExpectedVersion; |
| 9 | + public readonly string StreamName; |
| 10 | + public readonly Guid MessageId; |
| 11 | + public readonly byte[] MessageData; |
| 12 | + public readonly string MessageDataContract; |
| 13 | + public readonly byte[] MessageMetadata; |
| 14 | + public readonly int MessageOrdinal; |
| 15 | + public readonly Guid CausationId; |
| 16 | + public readonly Guid CorrelationId; |
| 17 | + |
| 18 | + public StreamRecord(byte[] streamId, string streamName, int streamExpectedVersion, Guid messageId, byte[] messageData, string messageDataContract, byte[] messageMetadata, int messageOrdinal, Guid causationId, Guid correlationId) |
| 19 | + { |
| 20 | + if (streamId == null) throw new ArgumentNullException("streamId"); |
| 21 | + if (streamExpectedVersion < 0) throw new ArgumentOutOfRangeException("streamExpectedVersion", streamExpectedVersion, "The expected version must be greater than or equal to 0."); |
| 22 | + if (streamName == null) throw new ArgumentNullException("streamName"); |
| 23 | + if (messageData == null) throw new ArgumentNullException("messageData"); |
| 24 | + if (messageDataContract == null) throw new ArgumentNullException("messageDataContract"); |
| 25 | + if (messageMetadata == null) throw new ArgumentNullException("messageMetadata"); |
| 26 | + if (messageOrdinal < 0) throw new ArgumentOutOfRangeException("messageOrdinal", messageOrdinal, "The message ordinal must be greater than or equal to 0."); |
| 27 | + StreamId = streamId; |
| 28 | + StreamExpectedVersion = streamExpectedVersion; |
| 29 | + StreamName = streamName; |
| 30 | + MessageId = messageId; |
| 31 | + MessageData = messageData; |
| 32 | + MessageDataContract = messageDataContract; |
| 33 | + MessageMetadata = messageMetadata; |
| 34 | + MessageOrdinal = messageOrdinal; |
| 35 | + CausationId = causationId; |
| 36 | + CorrelationId = correlationId; |
| 37 | + } |
| 38 | + } |
| 39 | +} |
0 commit comments