public void Handle(IViewContext context, DidStuff domainEvent) { var words = domainEvent.Text .Split(" ;,".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Count += words.Length; }
public void Handle(IViewContext context, DidStuff domainEvent) { var words = domainEvent.Text .Split(" ;,".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var numberOfHeys = words.Count(c => c.Equals("hej", StringComparison.CurrentCultureIgnoreCase)); Count += numberOfHeys; }
public void Handle(IViewContext context, DidStuff domainEvent) { if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = string.Format("thread-{0}", Interlocked.Increment(ref _threadIdCounter)); } Thread.Sleep(1000); HowManyThingsDidItDo++; Console.WriteLine("{0}: {1}", Thread.CurrentThread.Name, domainEvent.GetGlobalSequenceNumber()); }
public void Handle(IViewContext context, DidStuff domainEvent) { if (DependentViewsPosition > domainEvent.GetGlobalSequenceNumber()) { return; } var heyCounter = context.Get <IQueryable <HeyCounter> >("heys"); var wordCounter = context.Get <IQueryable <WordCounter> >("words"); var heys = heyCounter.First(v => v.Id == Id); var words = wordCounter.First(v => v.Id == Id); HeyPercentage = 100M * heys.Count / words.Count; DependentViewsPosition = Math.Min(heys.LastGlobalSequenceNumber, words.LastGlobalSequenceNumber); Console.WriteLine("Loading and stuff - {0}", DependentViewsPosition); }