Beispiel #1
0
 protected EntityCollectionManagerBase
     (TParent parent, IEventHandlerRegistrar <TEntityBaseEventInterface> appliersRegistrar)
 {
     ManagedEntities = new EntityCollection <TEntity, TEntityId>();
     _parent         = parent;
     appliersRegistrar
     .For <TEntityBaseEventInterface>(e => ManagedEntities[IdGetter.GetId(e)].ApplyEvent(e));
 }
Beispiel #2
0
 protected EntityCollectionManager
     (TParent parent,
     Action <TEntityBaseEventClass> raiseEventThroughParent,
     IEventHandlerRegistrar <TEntityBaseEventInterface> appliersRegistrar)
     : base(parent, raiseEventThroughParent, appliersRegistrar)
 {
     appliersRegistrar.For <TEntityRemovedEventInterface>(
         e =>
     {
         var id = IdGetter.GetId(e);
         ManagedEntities.Remove(id);
     });
 }
            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);
                }
            }
 protected EntityCollectionManager
     (TParent parent,
     Action <TEntityBaseEventClass> raiseEventThroughParent,
     IEventHandlerRegistrar <TEntityBaseEventInterface> appliersRegistrar)
 {
     ManagedEntities          = new EntityCollection <TEntity, TEntityId>();
     _raiseEventThroughParent = raiseEventThroughParent;
     _parent = parent;
     appliersRegistrar
     .For <TEntityCreatedEventInterface>(
         e =>
     {
         var entity = ObjectFactory <TEntity> .CreateInstance(_parent);
         ManagedEntities.Add(entity, IdGetter.GetId(e));
     })
     .For <TEntityBaseEventInterface>(e => ManagedEntities[IdGetter.GetId(e)].ApplyEvent(e));
 }