示例#1
0
        public static Func <TypeContract, IEnumerable <Action <INotification, TUowProvider> > > Given <TUowProvider>(
            this ProjectorsBySubscription <TUowProvider> subscriptions,
            params IDomainEvent[] given)
            where TUowProvider : IUowProvider
        {
            var list = given.AsEvents().ToList().AsReadOnly();

            return(n => subscriptions
                   .Where(p => p.Key.NotificationContract.Equals(n))
                   .Select(p => p.Value)
                   .Select <Projector <TUowProvider>, Action <INotification, TUowProvider> >(projector =>
                                                                                             (notification, provider) =>
                                                                                             projector(
                                                                                                 new Event {
                Notification = notification, EventId = list.OrderByDescending(g => g.EventId.Value).First().EventId.With(x => x.Increment())
            },
                                                                                                 NotificationsByCorrelations(list),
                                                                                                 () => DateTimeOffset.Now,
                                                                                                 provider)));
        }