Пример #1
0
        public virtual void Initialize(IAttributeSetStateCreated stateCreated)
        {
            var aggregateId = stateCreated.AttributeSetEventId.AttributeSetId;
            var state       = new AttributeSetState();

            state.AttributeSetId = aggregateId;
            var aggregate = (AttributeSetAggregate)GetAttributeSetAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Пример #2
0
        public virtual IAttributeSetState ToAttributeSetState()
        {
            var state = new AttributeSetState(true);

            state.AttributeSetId   = this.AttributeSetId;
            state.AttributeSetName = this.AttributeSetName;
            state.OrganizationId   = this.OrganizationId;
            state.Description      = this.Description;
            state.ReferenceId      = this.ReferenceId;
            if (this.IsInstanceAttributeSet != null && this.IsInstanceAttributeSet.HasValue)
            {
                state.IsInstanceAttributeSet = this.IsInstanceAttributeSet.Value;
            }
            if (this.IsMandatory != null && this.IsMandatory.HasValue)
            {
                state.IsMandatory = this.IsMandatory.Value;
            }
            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;
            }
            if (this.AttributeUses != null)
            {
                foreach (var s in this.AttributeUses)
                {
                    state.AttributeUses.AddToSave(s.ToAttributeUseState());
                }
            }
            ;

            return(state);
        }
Пример #3
0
 public static CreateAttributeSet ToCreateAttributeSet(this AttributeSetState state)
 {
     return(state.ToCreateAttributeSet <CreateAttributeSet, CreateAttributeUse>());
 }
Пример #4
0
 public static MergePatchAttributeSet ToMergePatchAttributeSet(this AttributeSetState state)
 {
     return(state.ToMergePatchAttributeSet <MergePatchAttributeSet, CreateAttributeUse, MergePatchAttributeUse>());
 }
Пример #5
0
 public static DeleteAttributeSet ToDeleteAttributeSet(this AttributeSetState state)
 {
     return(state.ToDeleteAttributeSet <DeleteAttributeSet>());
 }
Пример #6
0
 public static IAttributeSetCommand ToCreateOrMergePatchAttributeSet(this AttributeSetState state)
 {
     return(state.ToCreateOrMergePatchAttributeSet <CreateAttributeSet, MergePatchAttributeSet, CreateAttributeUse, MergePatchAttributeUse>());
 }