protected virtual IAttributeAliasMvoStateCreated Map(ICreateAttributeAliasMvo c) { var stateEventId = new AttributeAliasMvoEventId(c.AttributeAliasId, c.AttributeVersion); IAttributeAliasMvoStateCreated e = NewAttributeAliasMvoStateCreated(stateEventId); e.Name = c.Name; e.Version = c.Version; e.Active = c.Active; e.AttributeAttributeName = c.AttributeAttributeName; e.AttributeOrganizationId = c.AttributeOrganizationId; e.AttributeDescription = c.AttributeDescription; e.AttributeIsMandatory = c.AttributeIsMandatory; e.AttributeAttributeValueType = c.AttributeAttributeValueType; e.AttributeAttributeValueLength = c.AttributeAttributeValueLength; e.AttributeIsList = c.AttributeIsList; e.AttributeFieldName = c.AttributeFieldName; e.AttributeReferenceId = c.AttributeReferenceId; e.AttributeCreatedBy = c.AttributeCreatedBy; e.AttributeCreatedAt = c.AttributeCreatedAt; e.AttributeUpdatedBy = c.AttributeUpdatedBy; e.AttributeUpdatedAt = c.AttributeUpdatedAt; e.AttributeActive = c.AttributeActive; e.AttributeDeleted = c.AttributeDeleted; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var attributeVersion = c.AttributeVersion; return(e); }
public virtual void Initialize(IAttributeAliasMvoStateCreated stateCreated) { var aggregateId = stateCreated.AttributeAliasMvoEventId.AttributeAliasId; var state = new AttributeAliasMvoState(); state.AttributeAliasId = aggregateId; var aggregate = (AttributeAliasMvoAggregate)GetAttributeAliasMvoAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual void When(IAttributeAliasMvoStateCreated e) { ThrowOnWrongEvent(e); this.Name = e.Name; this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long); this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.AttributeAttributeName = e.AttributeAttributeName; this.AttributeOrganizationId = e.AttributeOrganizationId; this.AttributeDescription = e.AttributeDescription; this.AttributeIsMandatory = (e.AttributeIsMandatory != null && e.AttributeIsMandatory.HasValue) ? e.AttributeIsMandatory.Value : default(bool); this.AttributeAttributeValueType = e.AttributeAttributeValueType; this.AttributeAttributeValueLength = e.AttributeAttributeValueLength; this.AttributeIsList = (e.AttributeIsList != null && e.AttributeIsList.HasValue) ? e.AttributeIsList.Value : default(bool); this.AttributeFieldName = e.AttributeFieldName; this.AttributeReferenceId = e.AttributeReferenceId; this.AttributeCreatedBy = e.AttributeCreatedBy; this.AttributeCreatedAt = (e.AttributeCreatedAt != null && e.AttributeCreatedAt.HasValue) ? e.AttributeCreatedAt.Value : default(DateTime); this.AttributeUpdatedBy = e.AttributeUpdatedBy; this.AttributeUpdatedAt = (e.AttributeUpdatedAt != null && e.AttributeUpdatedAt.HasValue) ? e.AttributeUpdatedAt.Value : default(DateTime); this.AttributeActive = (e.AttributeActive != null && e.AttributeActive.HasValue) ? e.AttributeActive.Value : default(bool); this.AttributeDeleted = (e.AttributeDeleted != null && e.AttributeDeleted.HasValue) ? e.AttributeDeleted.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
public virtual AttributeAliasMvoStateCreatedDto ToAttributeAliasMvoStateCreatedDto(IAttributeAliasMvoStateCreated e) { var dto = new AttributeAliasMvoStateCreatedDto(); dto.AttributeAliasMvoEventId = e.AttributeAliasMvoEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.Version = e.Version; dto.Active = e.Active; dto.AttributeAttributeName = e.AttributeAttributeName; dto.AttributeOrganizationId = e.AttributeOrganizationId; dto.AttributeDescription = e.AttributeDescription; dto.AttributeIsMandatory = e.AttributeIsMandatory; dto.AttributeAttributeValueType = e.AttributeAttributeValueType; dto.AttributeAttributeValueLength = e.AttributeAttributeValueLength; dto.AttributeIsList = e.AttributeIsList; dto.AttributeFieldName = e.AttributeFieldName; dto.AttributeReferenceId = e.AttributeReferenceId; dto.AttributeCreatedBy = e.AttributeCreatedBy; dto.AttributeCreatedAt = e.AttributeCreatedAt; dto.AttributeUpdatedBy = e.AttributeUpdatedBy; dto.AttributeUpdatedAt = e.AttributeUpdatedAt; dto.AttributeActive = e.AttributeActive; dto.AttributeDeleted = e.AttributeDeleted; return(dto); }
void IAttributeAliasMvoState.When(IAttributeAliasMvoStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateAttributeAliasMvo c) { IAttributeAliasMvoStateCreated e = Map(c); Apply(e); }