예제 #1
0
파일: Entity.cs 프로젝트: Elders/Proteus
        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);
            }
        }
예제 #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);
            }
        }