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


C# Processing.ResolvedEvent类代码示例

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


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

示例1: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.PositionStreamId.StartsWith("$"))
                return false;
            var lastSlashPos = data.PositionStreamId.LastIndexOf(_separator);
            if (lastSlashPos < 0)
                return true; // handled but not interesting to us

            var category = data.PositionStreamId.Substring(0, lastSlashPos);

            string linkTarget;
            if (data.EventType == SystemEventTypes.LinkTo) 
                linkTarget = data.Data;
            else 
                linkTarget = data.EventSequenceNumber + "@" + data.EventStreamId;

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedLinkToWithRecategorization(
                        _categoryStreamPrefix + category, Guid.NewGuid(), linkTarget, eventPosition, expectedTag: null,
                        originalStreamId: data.PositionStreamId))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:30,代码来源:CategorizeEventsByStreamPath.cs

示例2: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;
            var category = _streamCategoryExtractor.GetCategoryByStreamId(data.PositionStreamId);
            if (category == null)
                return true; // handled but not interesting

            string linkTarget;
            if (data.EventType == SystemEventTypes.LinkTo) 
                linkTarget = data.Data;
            else 
                linkTarget = data.EventSequenceNumber + "@" + data.EventStreamId;

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedLinkToWithRecategorization(
                        _categoryStreamPrefix + category, Guid.NewGuid(), linkTarget, eventPosition, expectedTag: null,
                        originalStreamId: data.PositionStreamId))
            };

            return true;
        }
开发者ID:msbahrul,项目名称:EventStore,代码行数:27,代码来源:CategorizeEventsByStreamPath.cs

示例3: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category, ResolvedEvent data, out string newState,
            out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            if (!data.EventStreamId.StartsWith(UserStreamPrefix))
                throw new InvalidOperationException(
                    string.Format(
                        "Invalid stream name: '{0}' The IndexUsersProjectionHandler cannot handle events from other streams than named after the '$user-' pattern",
                        data.EventStreamId));

            var loginName = data.EventStreamId.Substring(UserStreamPrefix.Length);

            var userData = data.Data.ParseJson<UserData>();
            if (userData.LoginName != loginName)
                throw new InvalidOperationException(
                    string.Format(
                        "Invalid $UserCreated event found.  '{0}' login name expected, but '{1}' found", loginName,
                        userData.LoginName));

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        UsersStream, Guid.NewGuid(), UserEventType, false, loginName, null, eventPosition, null))
            };
            newState = "";
            return true;
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:29,代码来源:IndexUsersProjectionHandler.cs

示例4: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;
            if (data.EventStreamId != data.PositionStreamId)
                return false;
            var indexedEventType = data.EventType;
            if (indexedEventType == "$>")
                return false;

            string positionStreamId;
            var isStreamDeletedEvent = StreamDeletedHelper.IsStreamDeletedEvent(
                data.PositionStreamId, data.EventType, data.Data, out positionStreamId);
            if (isStreamDeletedEvent)
                indexedEventType = "$deleted";

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        _indexStreamPrefix + indexedEventType, Guid.NewGuid(), "$>", false,
                        data.EventSequenceNumber + "@" + positionStreamId,
                        isStreamDeletedEvent
                            ? new ExtraMetaData(new Dictionary<string, JRaw> {{"$deleted", new JRaw(-1)}})
                            : null, eventPosition, expectedTag: null))
            };

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

示例5: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
        {
            newSharedState = null;
            emittedEvents = null;
            newState = null;

            if (data.PositionSequenceNumber != 0)
                return false; // not our event

            var category = _streamCategoryExtractor.GetCategoryByStreamId(data.PositionStreamId);
            if (category == null)
                return true; // handled but not interesting

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        "$category" + "-" + category, Guid.NewGuid(), SystemEventTypes.StreamReference, false,
                        data.PositionStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:25,代码来源:CategorizeStreamByPath.cs

示例6: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEventEnvelope[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.PositionSequenceNumber != 0)
                return false; // not our event
            if (data.EventStreamId.StartsWith("$"))
                return false;
            var lastSlashPos = data.EventStreamId.LastIndexOf(_separator);
            if (lastSlashPos < 0)
                return true; // handled but not interesting to us

            var category = data.EventStreamId.Substring(0, lastSlashPos);

            emittedEvents = new[]
            {
                new EmittedEventEnvelope(
                    new EmittedDataEvent(
                        "$category" + _separator + category, Guid.NewGuid(), SystemEventTypes.StreamReference, false,
                        data.EventStreamId, null, eventPosition, expectedTag: null))
            };

            return true;
        }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:26,代码来源:CategorizeStreamByPath.cs

示例7: ProcessEvent

 public bool ProcessEvent(
     string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
     out string newState, out EmittedEventEnvelope[] emittedEvents)
 {
     emittedEvents = null;
     newState = null;
     return true;
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:8,代码来源:StubHandler.cs

示例8: ProcessEvent

 public bool ProcessEvent(
     string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
     out string newState, out EmittedEvent[] emittedEvents)
 {
     if (data.EventType == "fail" || _query == "fail")
         throw new Exception("failed");
     _logger("ProcessEvent(" + "..." + ")");
     newState = "{\"data\": " + _state + data + "}";
     emittedEvents = null;
     return true;
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:11,代码来源:FakeForeachStreamProjection.cs

示例9: ProcessEvent

 public bool ProcessEvent(
     string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
     out string newState, out string newSharedState, out EmittedEventEnvelope[] emittedEvents)
 {
     newSharedState = null;
     if (data.EventType == "fail" || _query == "fail")
         throw new Exception("failed");
     Log("ProcessEvent(" + "..." + ")");
     newState = "{\"data\": 1}";
     emittedEvents = null;
     return true;
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:12,代码来源:FakeProjection.cs

示例10: returns_emitted_events

        public void returns_emitted_events()
        {

            var e = new ResolvedEvent(
                "stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");

            EmittedEventEnvelope[] emittedEvents;
            _stateHandler.ProcessPartitionCreated(
                "partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);

            Assert.IsNotNull(emittedEvents);
            Assert.AreEqual(1, emittedEvents.Length);
            Assert.AreEqual("stream1", emittedEvents[0].Event.StreamId);
            Assert.AreEqual("event1", emittedEvents[0].Event.EventType);
            Assert.AreEqual("{\"a\":1}", emittedEvents[0].Event.Data);
        }
开发者ID:czcz1024,项目名称:EventStore,代码行数:16,代码来源:when_running_a_projection_with_created_handler.cs

示例11: Given

        protected override void Given()
        {
            base.Given();
            _streams = new[] {"pa", "pb"};
            ExistingEvent("a", "test1", "{}", "{}");
            ExistingEvent("b", "test1", "{}", "{}");

            ExistingEvent("pa", "$>", "[email protected]", "{$o:\"oa\"}");
            ExistingEvent("pb", "$>", "[email protected]", "{$o:\"ob\"}");

            _event1 = new ResolvedEvent("pa", 1, "a", 1, true, new TFPos(200, 150), Guid.NewGuid(), "test1", true, "{}", "{}", "{$o:\"oa\"");
            _event2 = new ResolvedEvent("pb", 1, "b", 1, true, new TFPos(300, 250), Guid.NewGuid(), "test1", true, "{}", "{}", "{$o:\"ob\"");

            NoOtherStreams();
            AllWritesSucceed();
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:16,代码来源:when_prerecording_event_order.cs

示例12: invokes_created_handler

        public void invokes_created_handler()
        {

            var e = new ResolvedEvent(
                "stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");
            
            EmittedEventEnvelope[] emittedEvents;
            _stateHandler.ProcessPartitionCreated(
                "partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);

            Assert.AreEqual(5, _logged.Count);
            Assert.AreEqual(@"handler-invoked", _logged[0]);
            Assert.AreEqual(@"stream", _logged[1]);
            Assert.AreEqual(@"event", _logged[2]);
            Assert.AreEqual(@"{}", _logged[3]);
            Assert.AreEqual(@"{""m"":1}", _logged[4]);
        }
开发者ID:czcz1024,项目名称:EventStore,代码行数:17,代码来源:when_running_a_projection_with_created_handler.cs

示例13: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEvent[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.EventSequenceNumber != 0)
                return false; // not our event

            emittedEvents = new[]
                {
                    new EmittedDataEvent(
                        SystemStreams.StreamsStream, Guid.NewGuid(), SystemEventTypes.LinkTo,
                        data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null)
                };

            return true;
        }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:18,代码来源:IndexStreams.cs

示例14: GetStatePartition

 public string GetStatePartition(
     CheckpointTag eventPosition, string category, ResolvedEvent @event)
 {
     CheckDisposed();
     if (@event == null) throw new ArgumentNullException("event");
     var partition = _query.GetPartition(
         @event.Data.Trim(), // trimming data passed to a JS
         new string[]
         {
             @event.EventStreamId, @event.IsJson ? "1" : "", @event.EventType, category ?? "",
             @event.EventSequenceNumber.ToString(CultureInfo.InvariantCulture), @event.Metadata ?? "",
             @event.PositionMetadata ?? ""
         });
     if (partition == "")
         return null;
     else
         return partition;
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:18,代码来源:V8ProjectionStateHandler.cs

示例15: ProcessEvent

        public bool ProcessEvent(
            string partition, CheckpointTag eventPosition, string category1, ResolvedEvent data,
            out string newState, out EmittedEvent[] emittedEvents)
        {
            emittedEvents = null;
            newState = null;
            if (data.EventStreamId != data.PositionStreamId)
                return false;
            if (data.EventType == "$>")
                return false;

            emittedEvents = new[]
                {
                    new EmittedDataEvent(
                        _indexStreamPrefix + data.EventType, Guid.NewGuid(), "$>",
                        data.EventSequenceNumber + "@" + data.EventStreamId, null, eventPosition, expectedTag: null)
                };

            return true;
        }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:20,代码来源:IndexEventsByEventType.cs


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