コード例 #1
0
ファイル: MainProgram.cs プロジェクト: kblooie/NEventStore
        private static void AppendToStream()
        {
            using (var stream = store.OpenStream(StreamId))
            {
                var @event = new SomeDomainEvent { Value = "Second event." };

                stream.Add(new EventMessage { Body = @event });
                stream.CommitChanges(Guid.NewGuid());
            }
        }
コード例 #2
0
ファイル: MainProgram.cs プロジェクト: kblooie/NEventStore
        private static void LoadFromSnapshotForwardAndAppend()
        {
            var latestSnapshot = store.Advanced.GetSnapshot(StreamId, int.MaxValue);

            using (var stream = store.OpenStream(latestSnapshot, int.MaxValue))
            {
                var @event = new SomeDomainEvent { Value = "Third event (first one after a snapshot)." };

                stream.Add(new EventMessage { Body = @event });
                stream.CommitChanges(Guid.NewGuid());
            }
        }
コード例 #3
0
ファイル: MainProgram.cs プロジェクト: Rustemt/NEventStore
		private static void OpenOrCreateStream()
		{
			// we can call CreateStream(StreamId) if we know there isn't going to be any data.
			// or we can call OpenStream(StreamId, 0, int.MaxValue) to read all commits,
			// if no commits exist then it creates a new stream for us.
			using (var stream = store.OpenStream(StreamId, 0, int.MaxValue))
			{
				var @event = new SomeDomainEvent { Value = "Initial event." };

				stream.Add(new EventMessage { Body = @event });
				stream.CommitChanges(Guid.NewGuid());
			}
		}
コード例 #4
0
        private static void AppendToStream()
        {
            using (var stream = store.OpenStream(StreamId))
            {
                var @event = new SomeDomainEvent {
                    Value = "Second event."
                };

                stream.Add(new EventMessage {
                    Body = @event
                });
                stream.CommitChanges(Guid.NewGuid());
            }
        }
コード例 #5
0
        private static void LoadFromSnapshotForwardAndAppend()
        {
            var latestSnapshot = store.Advanced.GetSnapshot(StreamId, int.MaxValue);

            using (var stream = store.OpenStream(latestSnapshot, int.MaxValue))
            {
                var @event = new SomeDomainEvent {
                    Value = "Third event (first one after a snapshot)."
                };

                stream.Add(new EventMessage {
                    Body = @event
                });
                stream.CommitChanges(Guid.NewGuid());
            }
        }
コード例 #6
0
        private static void OpenOrCreateStream()
        {
            // we can call CreateStream(StreamId) if we know there isn't going to be any data.
            // or we can call OpenStream(StreamId, 0, int.MaxValue) to read all commits,
            // if no commits exist then it creates a new stream for us.
            using (var stream = store.OpenStream(StreamId, 0, int.MaxValue))
            {
                var @event = new SomeDomainEvent {
                    Value = "Initial event."
                };

                stream.Add(new EventMessage {
                    Body = @event
                });
                stream.CommitChanges(Guid.NewGuid());
            }
        }