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); }); }
public Collection(TRootQueryModel aggregate) { _aggregate = aggregate; _aggregate.RegisterEventAppliers() .For <TEntityCreatedEventInterface>( e => { var component = (TEntitity)Activator.CreateInstance(typeof(TEntitity), nonPublic: true); component.RootQueryModel = _aggregate; _entities.Add(IdGetter.GetId(e), component); _entitiesInCreationOrder.Add(component); }) .For <TEntityBaseEventInterface>(e => _entities[IdGetter.GetId(e)].ApplyEvent(e)); }