Beispiel #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);
        }
Beispiel #3
0
 public static CreateRoleType ToCreateRoleType(this RoleTypeState state)
 {
     return(state.ToCreateRoleType <CreateRoleType>());
 }
Beispiel #4
0
 public static MergePatchRoleType ToMergePatchRoleType(this RoleTypeState state)
 {
     return(state.ToMergePatchRoleType <MergePatchRoleType>());
 }
Beispiel #5
0
 public static DeleteRoleType ToDeleteRoleType(this RoleTypeState state)
 {
     return(state.ToDeleteRoleType <DeleteRoleType>());
 }
Beispiel #6
0
 public static IRoleTypeCommand ToCreateOrMergePatchRoleType(this RoleTypeState state)
 {
     return(state.ToCreateOrMergePatchRoleType <CreateRoleType, MergePatchRoleType>());
 }