• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ClientAPI.ResolvedEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GotEvent

        private void GotEvent(EventStoreCatchUpSubscription sub, ResolvedEvent evt)
        {
            try
            {
                //create local copies of state variables
                var total = _total;
                var checkpoint = evt.Event.EventNumber;

                var amount = (string)JObject.Parse(Encoding.UTF8.GetString(evt.Event.Data))["amount"];
                switch (evt.Event.EventType.ToUpperInvariant())
                {
                    case "CREDIT":
                        total += int.Parse(amount);
                        break;
                    case "DEBIT":
                        total -= int.Parse(amount);
                        break;
                    default:
                        throw new Exception("Unknown Event Type");
                }
                File.WriteAllText(_localFile, checkpoint + "," + total);
                //Update the common state after commit to disk
                _total = total;
                Checkpoint = checkpoint;
            }
            catch (Exception ex)
            {
                _view.ErrorMsg = "Event Exception: " + ex.Message;
            }
            //repaint screen
            _view.Total = _total;
        }
开发者ID:RichieYang,项目名称:EventStore.Samples.Dotnet,代码行数:32,代码来源:BalanceReadModel.cs


示例2: StreamEventsSlice

        internal StreamEventsSlice(SliceReadStatus status, 
                                   string stream, 
                                   int fromEventNumber, 
                                   ReadDirection readDirection,
                                   ClientMessage.ResolvedIndexedEvent[] events,
                                   int nextEventNumber,
                                   int lastEventNumber,
                                   bool isEndOfStream)
        {
            Ensure.NotNullOrEmpty(stream, "stream");

            Status = status;
            Stream = stream;
            FromEventNumber = fromEventNumber;
            ReadDirection = readDirection;
            if (events == null || events.Length == 0)
                Events = Empty.ResolvedEvents;
            else
            {
                Events = new ResolvedEvent[events.Length];
                for (int i = 0; i < Events.Length; ++i)
                {
                    Events[i] = new ResolvedEvent(events[i]);
                }
            }
            NextEventNumber = nextEventNumber;
            LastEventNumber = lastEventNumber;
            IsEndOfStream = isEndOfStream;
        }
开发者ID:danieldeb,项目名称:EventStore,代码行数:29,代码来源:StreamEventsSlice.cs


示例3: EventAppeared

        void EventAppeared(EventStoreCatchUpSubscription sub, ResolvedEvent evnt)
        {
            if (evnt.OriginalStreamId.StartsWith("$"))
                return;
    
            dynamic ev = _adapter.TryGetDomainEvent(evnt);
            if (ev == null)
                return;

            try
            {
                lock (this)
                {
                    Dispatch(ev);
                    _succeded++;
                    _checkPoint = evnt.OriginalPosition.GetValueOrDefault();
                    _lastEventNumber = evnt.OriginalEventNumber;
                    if(ev.Timestamp > LastUpdate)
                        LastUpdate = ev.Timestamp;
                }
            }
            catch (Exception)
            {
                Debugger.Break();
            }
           
        }
开发者ID:valeriob,项目名称:MyBudget,代码行数:27,代码来源:InMemoryProjection.cs


示例4: EventAppeared

 private static void EventAppeared(EventStorePersistentSubscriptionBase eventStorePersistentSubscriptionBase,
     ResolvedEvent resolvedEvent)
 {
    ;
     var data = Encoding.ASCII.GetString(resolvedEvent.Event.Data);
     Console.WriteLine("Received: " + resolvedEvent.Event.EventStreamId + ":" + resolvedEvent.Event.EventNumber);
     Console.WriteLine(data);
 }
开发者ID:dcomartin,项目名称:EventStore.CompetingConsumers.Demo,代码行数:8,代码来源:Program.cs


示例5: CommandResponseReceived

        private void CommandResponseReceived(EventStoreSubscription subscription, ResolvedEvent resolvedEvent)
        {
            if (ResponseReceived == null) return;

            var response = resolvedEvent.ParseJson<CommandResponse>();

            ResponseReceived(this, new CommandResponseEventArgs(response));
        }
开发者ID:ajmal744,项目名称:EventStore-Examples,代码行数:8,代码来源:CommandResponseWatcher.cs


示例6: ProcessEvent

        private void ProcessEvent(EventStoreCatchUpSubscription subscribtion, ResolvedEvent resolvedEvent)
        {
            var alarm = resolvedEvent.ParseJson<IrresponsibleGamblerDetected>();

            Publish(alarm);

            StoreCheckpoint(resolvedEvent);
        }
开发者ID:ajmal744,项目名称:EventStore-Examples,代码行数:8,代码来源:IrresponsibleGamblerAlarmPublisher.cs


示例7: DeserializeEventData

        public static object DeserializeEventData(
            this ISerializer serializer,
            ResolvedEvent resolvedEvent)
        {
            IDictionary<string, object> _;

            return serializer.DeserializeEventData(resolvedEvent, out _);
        }
开发者ID:modulexcite,项目名称:Obsolete-Cedar,代码行数:8,代码来源:SerializationExtensions.cs


示例8: GetDomainEvent

 dynamic GetDomainEvent(ResolvedEvent evnt)
 {
     var metadata = evnt.Event.Metadata;
     var data = evnt.Event.Data;
     var jmeta = JObject.Parse(Encoding.UTF8.GetString(metadata));
     var eventClrTypeName = jmeta.Property(EventClrTypeHeader).Value;
     dynamic ev = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(data), Type.GetType((string)eventClrTypeName));
     return ev;
 }
开发者ID:valeriob,项目名称:MyBudget,代码行数:9,代码来源:EventAdapter.cs


示例9: EventAppeard

 private void EventAppeard(EventStoreSubscription subscription, ResolvedEvent @event)
 {
     var representation = _deserializer.GetRepresentation(_serializer, @event.OriginalEvent);
     var payload = representation.Payload;
     if (payload != null)
     {
         _self.Tell(payload);
     }
 }
开发者ID:megakid,项目名称:Akka.Persistence.EventStore,代码行数:9,代码来源:EventStoreSubscriptionView.cs


示例10: HandleNewEvent

 private void HandleNewEvent(EventStoreCatchUpSubscription subscription, ResolvedEvent @event)
 {
     // make sure the event fits the ones this handler cares about
     if (!_eventFilter(@event)) { return; }
     var _event = ProcessRawEvent(@event);
     // filter for null event ( didn't have metadata or data )
     if (_event == null) { return; }
     HandleEvent(_event);
 }
开发者ID:reharik,项目名称:EventSpike,代码行数:9,代码来源:DispatcherBase.cs


示例11: TryGetDomainEvent

 public dynamic TryGetDomainEvent(ResolvedEvent evnt)
 {
     try
     {
         return GetDomainEvent(evnt);
     }
     catch
     {
         return null;
     }
 }
开发者ID:valeriob,项目名称:MyBudget,代码行数:11,代码来源:EventAdapter.cs


示例12: Deserialize

 public IEnumerable<object> Deserialize(ResolvedEvent resolvedEvent)
 {
     var type = Type.GetType(resolvedEvent.Event.EventType + ", UserService.DomainModel", true);
     using (var stream = new MemoryStream(resolvedEvent.Event.Data))
     {
         using (var reader = new StreamReader(stream))
         {
             yield return JsonSerializer.CreateDefault().Deserialize(reader, type);
         }
     }
 }
开发者ID:rmacdonaldsmith,项目名称:EventSourcedUserService,代码行数:11,代码来源:RepositoryFactory.cs


示例13: MapToFeedItem

       private SyndicationItem MapToFeedItem(ResolvedEvent ev)
       {
           return new SyndicationItem(
               "BeganFollowingEvent",
               Encoding.UTF8.GetString(ev.Event.Data),
 new Uri(RequestContext.Url.Content("/beganfollowing/" +
   ev.Event.EventId)),
 ev.Event.EventId.ToString(),
               DateTime.Now // Event store client does not return timestamp yet
           );
       }
开发者ID:elbandit,项目名称:PPPDDD,代码行数:11,代码来源:BeganFollowingController.cs


示例14: OnEventReceived

 protected override void OnEventReceived(ResolvedEvent resolvedEvent)
 {
     switch (resolvedEvent.OriginalEvent.EventType)
     {
         case UserEventType.UserCreated:
             AddAccount(resolvedEvent.OriginalEvent);
             break;
         case ContactEventType.AccountContactRefreshRequest:
             ProcessRefreshRequest(resolvedEvent.OriginalEvent);
             break;
     }
 }
开发者ID:CallWall,项目名称:CallWall.Web,代码行数:12,代码来源:AccountContactSynchronizationService.cs


示例15: Map

        private static EventEnvelope Map(ResolvedEvent resolvedEvent)
        {
            var bytesAsString = Encoding.UTF8.GetString(resolvedEvent.Event.Data);
            var a = JsonConvert.DeserializeObject(bytesAsString) as IEvent;
            var jsonMetadata = Encoding.UTF8.GetString(resolvedEvent.Event.Metadata);
            var metadata = JsonConvert.DeserializeObject<EventMetadata>(jsonMetadata);
            var typeName = Type.GetType(metadata.Type);
            var @event = (IEvent)JsonConvert.DeserializeObject(bytesAsString, typeName);
            var envelope = new EventEnvelope(@event, metadata);

            return envelope;
        }
开发者ID:DrunkyBard,项目名称:CqrsMe,代码行数:12,代码来源:EventStoreExtensions.cs


示例16: Appeared

 private static void Appeared(EventStoreCatchUpSubscription subscription, ResolvedEvent resolvedEvent)
 {   
     if (resolvedEvent.Event.EventType.Contains("Question") || resolvedEvent.Event.EventType.Contains("Answer"))
     {
         Console.WriteLine("Read event {0} with data: {1}", 
             resolvedEvent.Event.EventType, 
             Encoding.UTF8.GetString(resolvedEvent.Event.Data));
         
         var @event = EventDeserializer.Deserialize(resolvedEvent.Event.EventType, Encoding.UTF8.GetString(resolvedEvent.Event.Data));
         _eventPublisher.Publish(@event);
     }
 }
开发者ID:dmusial,项目名称:StackLite,代码行数:12,代码来源:Program.cs


示例17: OnEventReceived

 protected override void OnEventReceived(ResolvedEvent resolvedEvent)
 {
     switch (resolvedEvent.OriginalEvent.EventType)
     {
         case UserEventType.UserCreated:
             AddUserToCache(resolvedEvent.OriginalEvent);
             break;
         case UserEventType.AccountRegistered:
             AddAccountToCache(resolvedEvent.OriginalEvent);
             break;
     }
 }
开发者ID:CallWall,项目名称:CallWall.Web,代码行数:12,代码来源:UserRepository.cs


示例18: PublishAsync

 public async Task PublishAsync(EventStorePersistentSubscriptionBase subscription, ResolvedEvent resolvedEvent) {
   try {
     object eventObject = resolvedEvent.Event.ToEventObject();
     using (Container.BeginExecutionContextScope()) {
       dynamic publisher = Container.GetInstance<IPublishEvent>();
       await publisher.PublishAsync((dynamic)eventObject).ConfigureAwait(true);
     }
     subscription.Acknowledge(resolvedEvent);
   } catch (Exception ex) {
     subscription.Fail(resolvedEvent, PersistentSubscriptionNakEventAction.Unknown, ex.Message);
   }
 }
开发者ID:grrizzly,项目名称:eventsourced.net,代码行数:12,代码来源:ResolvedEventPublisher.cs


示例19: StoreCommandData

        private static void StoreCommandData(ResolvedEvent evt, EventContext deserializedEvent, IDocumentSession session)
        {
            var commandId = deserializedEvent.Headers["CommandId"] as string;

            var commandModel = session.Load<CommandStatusModel>(commandId);
            if (commandModel == null)
            {
                commandModel = new CommandStatusModel() { Id = commandId };
                commandModel.Events = new List<EventStatusModel>();
                session.Store(commandModel);
            }
            commandModel.Events.Add(new EventStatusModel() { StreamId = evt.Event.EventStreamId, EventNumber = evt.Event.EventNumber, Type = evt.Event.EventType});
        }
开发者ID:pellehenriksson,项目名称:ReSTore,代码行数:13,代码来源:ViewBuilderService.cs


示例20: Deserialize

 public Snapshot Deserialize(ResolvedEvent resolvedEvent)
 {
     var type = Type.GetType(resolvedEvent.Event.EventType, true);
     var instance = Activator.CreateInstance(type);
     using (var stream = new MemoryStream(resolvedEvent.Event.Data))
     {
         using (var reader = new BinaryReader(stream))
         {
             ((IBinaryDeserializer) instance).Read(reader);
             return new Snapshot(BitConverter.ToInt32(resolvedEvent.Event.Metadata, 0), instance);
         }
     }
 }
开发者ID:jen20,项目名称:AggregateSource,代码行数:13,代码来源:SnapshotDeserializer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SystemData.UserCredentials类代码示例发布时间:2022-05-24
下一篇:
C# Forms.Label类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap