当前位置: 首页>>代码示例>>C#>>正文


C# EventRecord类代码示例

本文整理汇总了C#中EventRecord的典型用法代码示例。如果您正苦于以下问题:C# EventRecord类的具体用法?C# EventRecord怎么用?C# EventRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventRecord类属于命名空间,在下文中一共展示了EventRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToEntry

        public static EntryElement ToEntry(EventRecord evnt, string userHostName)
        {
            if (evnt == null || userHostName == null)
                return null;

            var entry = new EntryElement();

            entry.SetTitle(String.Format("{0} #{1}", evnt.EventStreamId, evnt.EventNumber));

            entry.SetId(HostName.Combine(userHostName, "/streams/{0}/{1}", evnt.EventStreamId, evnt.EventNumber));
            entry.SetUpdated(evnt.TimeStamp);

            entry.SetAuthor(AtomSpecs.Author);
            entry.SetSummary(String.Format("Entry #{0}", evnt.EventNumber));

            entry.AddLink(HostName.Combine(userHostName, "/streams/{0}/{1}", evnt.EventStreamId, evnt.EventNumber), "edit", null);

            entry.AddLink(
                HostName.Combine(userHostName, "/streams/{0}/event/{1}?format=text", evnt.EventStreamId, evnt.EventNumber),
                null,
                ContentType.PlainText);
            entry.AddLink(
                HostName.Combine(userHostName, "/streams/{0}/event/{1}?format=json", evnt.EventStreamId, evnt.EventNumber),
                "alternate",
                ContentType.Json);
            entry.AddLink(
                HostName.Combine(userHostName, "/streams/{0}/event/{1}?format=xml", evnt.EventStreamId, evnt.EventNumber),
                "alternate",
                ContentType.Xml);

            return entry;
        }
开发者ID:bmavity,项目名称:EventStore,代码行数:32,代码来源:Convert.cs

示例2: IndexReadEventResult

 public IndexReadEventResult(ReadEventResult result, EventRecord record, StreamMetadata metadata, int lastEventNumber)
 {
     Result = result;
     Record = record;
     Metadata = metadata;
     LastEventNumber = lastEventNumber;
 }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:7,代码来源:IndexReadEventResult.cs

示例3: EventLinkPair

            public EventLinkPair(Data.EventRecord eventRecord, Data.EventRecord linkRecord)
            {
                Event = new EventRecord(eventRecord);

                if (linkRecord != null)
                    Link = new EventRecord(linkRecord);
            }
开发者ID:robashton,项目名称:EventStore,代码行数:7,代码来源:TcpClientMessageDtoExtensions.cs

示例4: ResolvedEvent

 public ResolvedEvent(EventRecord @event)
 {
     Event = @event;
     Link = null;
     OriginalPosition = null;
     ResolveResult = default(ReadEventResult);
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:7,代码来源:ResolvedEvent.cs

示例5: IndexReadEventResult

 public IndexReadEventResult(ReadEventResult result, EventRecord record, StreamMetadata metadata, int lastEventNumber, bool originalStreamExists)
 {
     Result = result;
     Record = record;
     Metadata = metadata;
     LastEventNumber = lastEventNumber;
     OriginalStreamExists = originalStreamExists;
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:8,代码来源:IndexReadEventResult.cs

示例6: ToFeed

        public static FeedElement ToFeed(string eventStreamId, 
                                            int start, 
                                            int count, 
                                            DateTime updateTime,
                                            EventRecord[] items, 
                                            Func<EventRecord, string, EntryElement> itemToEntry,
                                            string userHostName)
        {
            if (string.IsNullOrEmpty(eventStreamId) || items == null || userHostName == null)
                return null;

            if (start == -1)
                start = GetActualStart(items);

            var self = HostName.Combine(userHostName, "/streams/{0}", eventStreamId);

            var feed = new FeedElement();

            feed.SetTitle(String.Format("Event stream '{0}'", eventStreamId));
            feed.SetId(self);

            feed.SetUpdated(updateTime);
            feed.SetAuthor(AtomSpecs.Author);

            feed.AddLink(self, "self", null);

            feed.AddLink(HostName.Combine(userHostName,
                                     "/streams/{0}/range/{1}/{2}",
                                     eventStreamId,
                                     AtomSpecs.FeedPageSize - 1,
                                     AtomSpecs.FeedPageSize),
                         "first",
                         null);

            feed.AddLink(HostName.Combine(userHostName,
                                     "/streams/{0}/range/{1}/{2}",
                                     eventStreamId,
                                     PrevStart(start),
                                     AtomSpecs.FeedPageSize),
                         "prev",
                         null);
            feed.AddLink(HostName.Combine(userHostName,
                                     "/streams/{0}/range/{1}/{2}",
                                     eventStreamId,
                                     NextStart(start),
                                     AtomSpecs.FeedPageSize),
                         "next",
                         null);

            foreach (var item in items)
            {
                feed.AddEntry(itemToEntry(item, userHostName));
            }

            return feed;
        }
开发者ID:bmavity,项目名称:EventStore,代码行数:56,代码来源:Convert.cs

示例7: WriteTestScenario

        protected override void WriteTestScenario()
        {
            _event1 = WriteSingleEvent("account--696193173", 0, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("account--696193173", 0, new string('.', 3000), retryOnFail: true);

            _event2 = WriteSingleEvent("LPN-FC002_LPK51001", 0, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("LPN-FC002_LPK51001", 0, new string('.', 3000), retryOnFail: true);

            _event3 = WriteSingleEvent("account--696193173", 1, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("account--696193173", 1, new string('.', 3000), retryOnFail: true);

            _event4 = WriteSingleEvent("LPN-FC002_LPK51001", 1, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("LPN-FC002_LPK51001", 1, new string('.', 3000), retryOnFail: true);

            _event5 = WriteSingleEvent("account--696193173", 2, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("account--696193173", 2, new string('.', 3000), retryOnFail: true);

            _event6 = WriteSingleEvent("LPN-FC002_LPK51001", 2, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("LPN-FC002_LPK51001", 2, new string('.', 3000), retryOnFail: true);

            _event7 = WriteSingleEvent("account--696193173", 3, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("account--696193173", 3, new string('.', 3000), retryOnFail: true);

            _event8 = WriteSingleEvent("LPN-FC002_LPK51001", 3, new string('.', 3000), retryOnFail: true);
                      WriteSingleEvent("LPN-FC002_LPK51001", 3, new string('.', 3000), retryOnFail: true);

            WriteSingleEvent("RandomStream", 0, new string('.', 3000), retryOnFail: true);
            WriteSingleEvent("RandomStream", 1, new string('.', 3000), retryOnFail: true);

            Scavenge(completeLast: false, mergeChunks: false);
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:31,代码来源:when_deleting_duplicate_events.cs

示例8: WriteTestScenario

        protected override void WriteTestScenario()
        {
            _prepare1 = WriteSingleEvent("AB", 0, "test1");
            _delete1 = WriteDelete("AB");

            _prepare2 = WriteSingleEvent("CD", 0, "test2");
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:7,代码来源:with_two_collisioned_streams_one_event_each_first_stream_deleted_read_index_should.cs

示例9: WriteTestScenario

        protected override void WriteTestScenario()
        {
            var t1 = WriteTransactionBegin("ES", ExpectedVersion.NoStream);
            var t2 = WriteTransactionBegin("ABC", ExpectedVersion.NoStream);

            _p1 = WriteTransactionEvent(t1.CorrelationId, t1.LogPosition, 0, t1.EventStreamId, 0, "es1", PrepareFlags.Data);
            _p2 = WriteTransactionEvent(t2.CorrelationId, t2.LogPosition, 0, t2.EventStreamId, 0, "abc1", PrepareFlags.Data);
            _p3 = WriteTransactionEvent(t1.CorrelationId, t1.LogPosition, 1, t1.EventStreamId, 1, "es1", PrepareFlags.Data);
            _p4 = WriteTransactionEvent(t2.CorrelationId, t2.LogPosition, 1, t2.EventStreamId, 1, "abc1", PrepareFlags.Data);
            _p5 = WriteTransactionEvent(t1.CorrelationId, t1.LogPosition, 2, t1.EventStreamId, 2, "es1", PrepareFlags.Data);

            WriteTransactionEnd(t2.CorrelationId, t2.TransactionPosition, t2.EventStreamId);
            WriteTransactionEnd(t1.CorrelationId, t1.TransactionPosition, t1.EventStreamId);

            _t2CommitPos = WriteCommit(t2.CorrelationId, t2.TransactionPosition, t2.EventStreamId, _p2.EventNumber);
            _t1CommitPos = WriteCommit(t1.CorrelationId, t1.TransactionPosition, t1.EventStreamId, _p1.EventNumber);

            _pos6 = Db.Config.WriterCheckpoint.ReadNonFlushed();
            var r6 = LogRecord.Prepare(_pos6, Guid.NewGuid(), Guid.NewGuid(), _pos6, 0, "t1", -1, PrepareFlags.SingleWrite, "et", LogRecord.NoData, LogRecord.NoData);
            Writer.Write(r6, out _pos7);
            var r7 = LogRecord.Prepare(_pos7, Guid.NewGuid(), Guid.NewGuid(), _pos7, 0, "t1", -1, PrepareFlags.SingleWrite, "et", LogRecord.NoData, LogRecord.NoData);
            Writer.Write(r7, out _pos8);
            var r8 = LogRecord.Prepare(_pos8, Guid.NewGuid(), Guid.NewGuid(), _pos8, 0, "t1", -1, PrepareFlags.SingleWrite, "et", LogRecord.NoData, LogRecord.NoData);
            long pos9;
            Writer.Write(r8, out pos9);
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:26,代码来源:when_having_two_intermingled_transactions_and_some_uncommited_prepares_in_the_end_read_index_should.cs

示例10: WriteTestScenario

        protected override void WriteTestScenario()
        {
            var now = DateTime.UtcNow;

            var metadata1 = string.Format(@"{{""$maxAge"":{0}}}", (int)TimeSpan.FromMinutes(25).TotalSeconds);
            const string metadata2 = @"{""$maxCount"":2}";

            _r11 = WriteStreamMetadata("ES1", 0, metadata1);
            _r21 = WriteStreamMetadata("ES2", 0, metadata2);

            _r12 = WriteSingleEvent("ES1", 0, "bla1", now.AddMinutes(-100));
            _r13 = WriteSingleEvent("ES1", 1, "bla1", now.AddMinutes(-20));

            _r22 = WriteSingleEvent("ES2", 0, "bla1", now.AddMinutes(-100));
            _r23 = WriteSingleEvent("ES2", 1, "bla1", now.AddMinutes(-20));

            _r14 = WriteSingleEvent("ES1", 2, "bla1", now.AddMinutes(-11));
            _r24 = WriteSingleEvent("ES2", 2, "bla1", now.AddMinutes(-10));

            _r15 = WriteSingleEvent("ES1", 3, "bla1", now.AddMinutes(-5));
            _r16 = WriteSingleEvent("ES1", 4, "bla1", now.AddMinutes(-2));

            _r25 = WriteSingleEvent("ES2", 3, "bla1", now.AddMinutes(-1));
            _r26 = WriteSingleEvent("ES2", 4, "bla1", now.AddMinutes(-1));
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:25,代码来源:when_having_one_stream_with_maxage_and_other_stream_with_maxcount_and_streams_have_same_hash.cs

示例11: WriteTestScenario

        protected override void WriteTestScenario()
        {
            _prepare1 = WriteSingleEvent("ES", 0, "test1");

            _prepare2 = WriteSingleEvent("ESES", 0, "test2");
            _prepare3 = WriteSingleEvent("ESES", 1, "test3");
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:7,代码来源:with_no_hash_collisions_read_index_should.cs

示例12: WriteTestScenario

        protected override void WriteTestScenario()
        {
            _event1 = WriteSingleEvent("ES", 0, new string('.', 500));
            _event2 = WriteSingleEvent("ES", 1, new string('.', 500));    // truncated
            _event3 = WriteSingleEvent("ES", 2, new string('.', 500));    // truncated

            TruncateCheckpoint = _event2.LogPosition;
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:when_truncating_single_uncompleted_chunk_with_index_in_memory_and_then_reopening_db.cs

示例13: WriteTestScenario

 protected override void WriteTestScenario()
 {
     _event0 = WriteSingleEvent("ES", 0, "bla");
     _event1 = WriteSingleEvent("ES", 1, "bla");
     _event2 = WriteSingleEvent("ES", 2, "bla");
     _event3 = WriteSingleEvent("ES", 3, "bla");
     _event4 = WriteSingleEvent("ES", 4, "bla");
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:when_reading_stream_with_no_max_age_max_count.cs

示例14: WriteTestScenario

        protected override void WriteTestScenario()
        {
            _p1 = WriteTransactionBegin("ES", ExpectedVersion.NoStream, 0, "test1");
            _p2 = WriteTransactionEvent(_p1.CorrelationId, _p1.LogPosition, 1, _p1.EventStreamId, 1, "test2", PrepareFlags.Data);
            _p3 = WriteTransactionEvent(_p1.CorrelationId, _p1.LogPosition, 2, _p1.EventStreamId, 2, "test3", PrepareFlags.TransactionEnd | PrepareFlags.Data);

            WriteCommit(_p1.CorrelationId, _p1.LogPosition, _p1.EventStreamId, _p1.EventNumber);
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:when_having_multievent_sequential_write_request_read_index_should.cs

示例15: ReadEventResult

        public ReadEventResult(SingleReadResult result)
        {
            if (result == SingleReadResult.Success)
                throw new ArgumentException(string.Format("Wrong SingleReadResult provided for failure constructor: {0}.", result), "result");

            Result = result;
            Record = null;
        }
开发者ID:robashton,项目名称:EventStore,代码行数:8,代码来源:ReadEventResult.cs


注:本文中的EventRecord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。