示例#1
0
        protected virtual IAttributeSetStateCreated Map(ICreateAttributeSet c)
        {
            var stateEventId            = new AttributeSetEventId(c.AttributeSetId, c.Version);
            IAttributeSetStateCreated e = NewAttributeSetStateCreated(stateEventId);

            e.AttributeSetName       = c.AttributeSetName;
            e.OrganizationId         = c.OrganizationId;
            e.Description            = c.Description;
            e.ReferenceId            = c.ReferenceId;
            e.IsInstanceAttributeSet = c.IsInstanceAttributeSet;
            e.IsMandatory            = c.IsMandatory;
            e.Active    = c.Active;
            e.CommandId = c.CommandId;


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

            foreach (ICreateAttributeUse innerCommand in c.AttributeUses)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeUseStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddAttributeUseEvent(innerEvent);
            }


            return(e);
        }
示例#2
0
        protected AttributeSetStateDeleted NewAttributeSetStateDeleted(long version, string commandId, string requesterId)
        {
            var stateEventId = new AttributeSetEventId(_state.AttributeSetId, version);
            var e            = NewAttributeSetStateDeleted(stateEventId);

            e.CommandId = commandId;

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

            return(e);
        }
示例#3
0
        protected virtual IAttributeSetStateDeleted Map(IDeleteAttributeSet c)
        {
            var stateEventId            = new AttributeSetEventId(c.AttributeSetId, c.Version);
            IAttributeSetStateDeleted e = NewAttributeSetStateDeleted(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);
            }

            AttributeSetEventId other = obj as AttributeSetEventId;

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

            return(true &&
                   Object.Equals(this.AttributeSetId, other.AttributeSetId) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
示例#5
0
 protected AttributeSetEventBase(AttributeSetEventId stateEventId)
 {
     this.AttributeSetEventId = stateEventId;
 }
示例#6
0
 public AttributeSetStateDeleted(AttributeSetEventId stateEventId) : base(stateEventId)
 {
 }
示例#7
0
 public AttributeSetStateMergePatched(AttributeSetEventId stateEventId) : base(stateEventId)
 {
 }
示例#8
0
 protected AttributeSetStateEventBase(AttributeSetEventId stateEventId) : base(stateEventId)
 {
 }
示例#9
0
 private AttributeSetStateDeleted NewAttributeSetStateDeleted(AttributeSetEventId stateEventId)
 {
     return(new AttributeSetStateDeleted(stateEventId));
 }
示例#10
0
 private AttributeSetStateMergePatched NewAttributeSetStateMergePatched(AttributeSetEventId stateEventId)
 {
     return(new AttributeSetStateMergePatched(stateEventId));
 }