Esempio n. 1
0
        public virtual IRoleTypeState ToRoleTypeState()
        {
            var state = new RoleTypeState(true);

            state.RoleTypeId   = this.RoleTypeId;
            state.ParentTypeId = this.ParentTypeId;
            state.HasTable     = this.HasTable;
            state.Description  = this.Description;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
        public virtual void Initialize(IRoleTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.RoleTypeEventId.RoleTypeId;
            var state       = new RoleTypeState();

            state.RoleTypeId = aggregateId;
            var aggregate = (RoleTypeAggregate)GetRoleTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Esempio n. 3
0
 public static CreateRoleType ToCreateRoleType(this RoleTypeState state)
 {
     return(state.ToCreateRoleType <CreateRoleType>());
 }
Esempio n. 4
0
 public static MergePatchRoleType ToMergePatchRoleType(this RoleTypeState state)
 {
     return(state.ToMergePatchRoleType <MergePatchRoleType>());
 }
Esempio n. 5
0
 public static DeleteRoleType ToDeleteRoleType(this RoleTypeState state)
 {
     return(state.ToDeleteRoleType <DeleteRoleType>());
 }
Esempio n. 6
0
 public static IRoleTypeCommand ToCreateOrMergePatchRoleType(this RoleTypeState state)
 {
     return(state.ToCreateOrMergePatchRoleType <CreateRoleType, MergePatchRoleType>());
 }