Exemplo n.º 1
0
        public static TestAggregate FromEvents(IUtcTimeTimeSource timeSource, Guid?id, IEnumerable <Type> events)
        {
            var rootEvents = events.ToEvents();

            rootEvents.Cast <AggregateRootEvent>().First().AggregateRootId = id ?? Guid.NewGuid();
            return(new TestAggregate(timeSource, rootEvents));
        }
Exemplo n.º 2
0
 //Yes empty. Id should be assigned by an action and it should be obvious that the aggregate in invalid until that happens
 protected AggregateRoot(IUtcTimeTimeSource timeSource) : base(Guid.Empty)
 {
     Contract.Assert(timeSource != null);
     Contract.Assert(typeof(TAggregateRootBaseEventInterface).IsInterface);
     TimeSource = timeSource;
     _eventHandlersEventDispatcher.Register().IgnoreUnhandled <IAggregateRootEvent>();
 }
Exemplo n.º 3
0
 protected NestedComponent
     (IUtcTimeTimeSource timeSource,
     Action <TNestedComponentBaseEventClass> raiseEventThroughParent,
     IEventHandlerRegistrar <TNestedComponentBaseEventInterface> appliersRegistrar,
     bool registerEventAppliers) : base(timeSource, raiseEventThroughParent, appliersRegistrar, registerEventAppliers)
 {
 }
 protected NestedEntity
     (IUtcTimeTimeSource timeSource,
     Action <TEntityBaseEventClass> raiseEventThroughParent,
     IEventHandlerRegistrar <TEntityBaseEventInterface> appliersRegistrar)
     : base(timeSource, raiseEventThroughParent, appliersRegistrar, registerEventAppliers: false)
 {
     RegisterEventAppliers()
     .For <TEntityCreatedEventInterface>(e => Id = IdGetterSetter.GetId(e));
 }
Exemplo n.º 5
0
 protected SlavedNestedEntity
     (IUtcTimeTimeSource timeSource,
     Action <TEntityBaseEventClass> raiseEventThroughParent,
     IEventHandlerRegistrar <TEntityBaseEventInterface> appliersRegistrar)
     : base(timeSource, raiseEventThroughParent, appliersRegistrar, registerEventAppliers: false)
 {
     RegisterEventAppliers()
     .IgnoreUnhandled <TEntityBaseEventInterface>();
 }
Exemplo n.º 6
0
        public EventStoreSession(IServiceBus bus, IEventStore store, ISingleContextUseGuard usageGuard, IUtcTimeTimeSource timeSource)
        {
            Contract.Requires(bus != null);
            Contract.Requires(store != null);
            Contract.Requires(usageGuard != null);
            Contract.Requires(timeSource != null);

            _usageGuard = usageGuard;
            _bus        = bus;
            _store      = store;
            TimeSource  = timeSource ?? DateTimeNowTimeSource.Instance;
        }
Exemplo n.º 7
0
            internal Component(IUtcTimeTimeSource timeSource, Action <TComponentBaseEventClass> raiseEventThroughParent, IEventHandlerRegistrar <TComponentBaseEventInterface> appliersRegistrar, bool registerEventAppliers)
            {
                TimeSource = timeSource;
                _raiseEventThroughParent = raiseEventThroughParent;
                _eventHandlersEventDispatcher.Register()
                .IgnoreUnhandled <TComponentBaseEventInterface>();

                if (registerEventAppliers)
                {
                    appliersRegistrar
                    .For <TComponentBaseEventInterface>(ApplyEvent);
                }
            }
Exemplo n.º 8
0
 void IEventStored.SetTimeSource(IUtcTimeTimeSource timeSource)
 {
     TimeSource = timeSource;
 }
 public AccountManagementEventStoreSession(IServiceBus bus, IEventStore store, ISingleContextUseGuard usageGuard, IUtcTimeTimeSource timeSource)
     : base(bus, store, usageGuard, timeSource)
 {
 }
 public AccountManagementEventStoreSession(IServiceBus bus, IEventStore store, ISingleContextUseGuard usageGuard, IUtcTimeTimeSource timeSource)
     : base(bus, store, usageGuard, timeSource) {}
Exemplo n.º 11
0
 public static TestAggregate FromEvents <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(IUtcTimeTimeSource timeSource, Guid?id = null)
 {
     return(FromEvents(timeSource, id, Seq.OfTypes <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>()));
 }
Exemplo n.º 12
0
 public static TestAggregate FromEvents <T1, T2, T3, T4, T5, T6, T7, T8>(IUtcTimeTimeSource timeSource, Guid?id = null)
 {
     return(FromEvents(timeSource, id, Seq.OfTypes <T1, T2, T3, T4, T5, T6, T7, T8>()));
 }
Exemplo n.º 13
0
 public static TestAggregate FromEvents(IUtcTimeTimeSource timeSource, params RootEvent[] events)
 {
     return(new TestAggregate(timeSource, events));
 }
Exemplo n.º 14
0
        public TestAggregate(IUtcTimeTimeSource timeSource, params RootEvent[] events) : this(timeSource)
        {
            Contract.Requires(events.First() is IAggregateRootCreatedEvent);

            RaiseEvents(events);
        }
Exemplo n.º 15
0
 private TestAggregate(IUtcTimeTimeSource timeSource) : base(timeSource)
 {
     SetupAppliers();
 }