public virtual void Initialize(IOrganizationStructureStateCreated stateCreated)
        {
            var aggregateId = stateCreated.OrganizationStructureEventId.Id;
            var state       = new OrganizationStructureState();

            state.Id = aggregateId;
            var aggregate = (OrganizationStructureAggregate)GetOrganizationStructureAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
        protected virtual IOrganizationStructureStateCreated Map(ICreateOrganizationStructure c)
        {
            var stateEventId = new OrganizationStructureStateEventId(c.Id, c.Version);
            IOrganizationStructureStateCreated e = NewOrganizationStructureStateCreated(stateEventId);

            e.Active    = c.Active;
            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            var version = c.Version;


            return(e);
        }
        protected virtual IOrganizationStructureStateCreated Map(ICreateOrganizationStructure c)
        {
            var stateEventId = new OrganizationStructureEventId(c.Id, c.Version);
            IOrganizationStructureStateCreated e = NewOrganizationStructureStateCreated(stateEventId);

            e.Active    = c.Active;
            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;


            return(e);
        }
Пример #4
0
 void IOrganizationStructureState.When(IOrganizationStructureStateCreated e)
 {
     throw new NotSupportedException();
 }