Ejemplo n.º 1
0
        protected Entity(TAggregateRoot root)
        {
            this.root  = root;
            this.state = new TEntityState();
            var mapping = new DomainObjectEventHandlerMapping();

            foreach (var handlerAction in mapping.GetEventHandlers(() => this.state))
            {
                root.RegisterEventHandler(handlerAction.Key, handlerAction.Value);
            }
        }
Ejemplo n.º 2
0
        protected Entity(TAggregateRoot root, IEntityId entityId)
        {
            this.root  = root;
            this.state = new TEntityState();
            var dynamicState = (dynamic)this.state;

            dynamicState.EntityId = (dynamic)entityId;
            var mapping = new DomainObjectEventHandlerMapping();

            foreach (var handlerAction in mapping.GetEventHandlers(() => this.state))
            {
                root.RegisterEventHandler(state.EntityId, handlerAction.Key, handlerAction.Value);
            }
        }