protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e) { if (!(e is NodeAttachedToParentNode)) throw new ArgumentException(String.Format("Can't handle {0}", e)); var node = context.Load<Node>(e.GetAggregateRootId()); while (node.ParentNodeId != null) { node = context.Load<Node>(node.ParentNodeId); } return new[] { node.Id }; }
public void Handle(IViewContext context, DomainEvent <Root> domainEvent) { SecretBizTimes = context .Load <Root>(domainEvent.GetAggregateRootId()) .SecretBizTimes .ToArray(); }
public void Handle(IViewContext context, NumberEvent domainEvent) { var aggregateRootId = domainEvent.GetAggregateRootId(); var instance = context.Load <AggregateRootWithLogic>(aggregateRootId); Counter = instance.Counter; }
protected override IEnumerable <string> GetViewIds(IViewContext context, DomainEvent e) { if (!(e is NodeAttachedToParentNode)) { throw new ArgumentException(String.Format("Can't handle {0}", e)); } var node = context.Load <Node>(e.GetAggregateRootId()); while (node.ParentNodeId != null) { node = context.Load <Node>(node.ParentNodeId); } return(new[] { node.Id }); }
public void Handle(IViewContext context, CountingRootIncremented domainEvent) { Console.WriteLine("Loading aggregate root"); var root = context.Load <CountingRoot>(domainEvent.GetAggregateRootId()); Console.WriteLine($"Got the number {root.Number} from it"); Number = root.Number; }
public void Handle(IViewContext context, Event domainEvent) { AggregateRootIds.Add(domainEvent.GetAggregateRootId()); foreach (var root in AggregateRootIds.Select(id => context.Load <Root>(id))) { EventsForEachRoot[root.Id] = root.EventsProcessed; } }
public void Handle(IViewContext context, RootGotNewNumber domainEvent) { var stopwatch = Stopwatch.StartNew(); var dispatchTime = DateTime.UtcNow; var aggregateRootId = domainEvent.GetAggregateRootId(); var root = context.Load <Root>(aggregateRootId); NumbersByRoot[aggregateRootId] = root.GetNumber(); var stats = (ConcurrentQueue <TestNewNewSnapshotting.DispatchStats>)context.Items["stats"]; stats.Enqueue(new TestNewNewSnapshotting.DispatchStats(dispatchTime, stopwatch.Elapsed)); }
public void Handle(IViewContext context, MemberRegisteredToAssociation domainEvent) { if (!AllUsersAssociations.ContainsKey(domainEvent.MemberId)) { AllUsersAssociations.Add(domainEvent.MemberId, new List <UserAssociation>()); } var association = context.Load <Domain.Association>(domainEvent.GetAggregateRootId()); AllUsersAssociations[domainEvent.MemberId].Add(new UserAssociation { Id = association.Id, Name = association.Name }); }
public void Handle(IViewContext context, CounterIncremented domainEvent) { CurrentValue += domainEvent.Delta; var counter = context.Load <Counter>(domainEvent.GetAggregateRootId(), domainEvent.GetGlobalSequenceNumber()); SecretBizValue = counter.GetSecretBizValue(); SomeRecentBizValues.Add(SecretBizValue); // trim to 10 most recent biz values while (SomeRecentBizValues.Count > 10) { SomeRecentBizValues.RemoveAt(0); } }
public void Handle(IViewContext context, Event domainEvent) { Console.WriteLine("Event dispatched to view: {0}", domainEvent); try { var root = context.Load <Root>(domainEvent.GetAggregateRootId()); AppliedEventsAccordingToRoot = root.AppliedEvents; AppliedEventsAccordingToView++; } catch (Exception exception) { Console.WriteLine("Error dispatching: {0}", exception); throw; } }
public void Handle(IViewContext context, OneWootDidItsThing domainEvent) { var oneWoot = context.Load <OneWoot>(domainEvent.GetAggregateRootId()); ReadLists.Add(oneWoot.ReadCounts.ToList()); }
public void Handle(IViewContext context, AnEvent domainEvent) { var root = context.Load <MyRoot>("randomid"); }
public void Handle(IViewContext context, AnEvent domainEvent) { var root = context.Load <MyRoot>(domainEvent.GetAggregateRootId()); root.DoStuff(); }
public void Handle(IViewContext context, AnEvent domainEvent) { var myRoot = context.Load <MyRoot>(domainEvent.GetAggregateRootId()); Calls.Add(Tuple.Create(myRoot.LastEmittedEventNumber, domainEvent.EventNumber)); }