示例#1
0
        protected AttributeStateDeleted NewAttributeStateDeleted(long version, string commandId, string requesterId)
        {
            var stateEventId = new AttributeEventId(_state.AttributeId, version);
            var e            = NewAttributeStateDeleted(stateEventId);

            e.CommandId = commandId;

            e.CreatedBy = (string)requesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            return(e);
        }
示例#2
0
        protected virtual IAttributeStateMergePatched Map(IMergePatchAttribute c)
        {
            var stateEventId = new AttributeEventId(c.AttributeId, c.Version);
            IAttributeStateMergePatched e = NewAttributeStateMergePatched(stateEventId);

            e.AttributeName        = c.AttributeName;
            e.OrganizationId       = c.OrganizationId;
            e.Description          = c.Description;
            e.IsMandatory          = c.IsMandatory;
            e.AttributeValueType   = c.AttributeValueType;
            e.AttributeValueLength = c.AttributeValueLength;
            e.IsList      = c.IsList;
            e.FieldName   = c.FieldName;
            e.ReferenceId = c.ReferenceId;
            e.Active      = c.Active;
            e.IsPropertyAttributeNameRemoved        = c.IsPropertyAttributeNameRemoved;
            e.IsPropertyOrganizationIdRemoved       = c.IsPropertyOrganizationIdRemoved;
            e.IsPropertyDescriptionRemoved          = c.IsPropertyDescriptionRemoved;
            e.IsPropertyIsMandatoryRemoved          = c.IsPropertyIsMandatoryRemoved;
            e.IsPropertyAttributeValueTypeRemoved   = c.IsPropertyAttributeValueTypeRemoved;
            e.IsPropertyAttributeValueLengthRemoved = c.IsPropertyAttributeValueLengthRemoved;
            e.IsPropertyIsListRemoved      = c.IsPropertyIsListRemoved;
            e.IsPropertyFieldNameRemoved   = c.IsPropertyFieldNameRemoved;
            e.IsPropertyReferenceIdRemoved = c.IsPropertyReferenceIdRemoved;
            e.IsPropertyActiveRemoved      = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;

            foreach (IAttributeValueCommand innerCommand in c.AttributeValueCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeValueEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddAttributeValueEvent(innerEvent);
            }

            foreach (IAttributeAliasCommand innerCommand in c.AttributeAliasCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeAliasEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddAttributeAliasEvent(innerEvent);
            }


            return(e);
        }
示例#3
0
        protected virtual IAttributeStateDeleted Map(IDeleteAttribute c)
        {
            var stateEventId         = new AttributeEventId(c.AttributeId, c.Version);
            IAttributeStateDeleted e = NewAttributeStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


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


            return(e);
        }
示例#4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            AttributeEventId other = obj as AttributeEventId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.AttributeId, other.AttributeId) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
示例#5
0
 protected AttributeEventBase(AttributeEventId stateEventId)
 {
     this.AttributeEventId = stateEventId;
 }
示例#6
0
 public AttributeStateDeleted(AttributeEventId stateEventId) : base(stateEventId)
 {
 }
示例#7
0
 public AttributeStateMergePatched(AttributeEventId stateEventId) : base(stateEventId)
 {
 }
示例#8
0
 public AttributeStateCreated(AttributeEventId stateEventId) : base(stateEventId)
 {
 }
示例#9
0
 protected AttributeStateEventBase(AttributeEventId stateEventId) : base(stateEventId)
 {
 }
示例#10
0
 private AttributeStateDeleted NewAttributeStateDeleted(AttributeEventId stateEventId)
 {
     return(new AttributeStateDeleted(stateEventId));
 }
示例#11
0
 private AttributeStateMergePatched NewAttributeStateMergePatched(AttributeEventId stateEventId)
 {
     return(new AttributeStateMergePatched(stateEventId));
 }