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


C# ClientAPI.ResolvedEvent类代码示例

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


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


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