Exemple #1
0
        public virtual IRolePermissionState ToRolePermissionState()
        {
            var state = new RolePermissionState(true);

            state.Id = (this.Id == null) ? null : this.Id.ToRolePermissionId();
            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(IRolePermissionStateCreated stateCreated)
        {
            var aggregateId = stateCreated.RolePermissionEventId.Id;
            var state       = new RolePermissionState();

            state.Id = aggregateId;
            var aggregate = (RolePermissionAggregate)GetRolePermissionAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
 public static CreateRolePermission ToCreateRolePermission(this RolePermissionState state)
 {
     return(state.ToCreateRolePermission <CreateRolePermission>());
 }
 public static MergePatchRolePermission ToMergePatchRolePermission(this RolePermissionState state)
 {
     return(state.ToMergePatchRolePermission <MergePatchRolePermission>());
 }
 public static DeleteRolePermission ToDeleteRolePermission(this RolePermissionState state)
 {
     return(state.ToDeleteRolePermission <DeleteRolePermission>());
 }
 public static IRolePermissionCommand ToCreateOrMergePatchRolePermission(this RolePermissionState state)
 {
     return(state.ToCreateOrMergePatchRolePermission <CreateRolePermission, MergePatchRolePermission>());
 }