public virtual IDocumentTypeState ToDocumentTypeState() { var state = new DocumentTypeState(true); state.DocumentTypeId = this.DocumentTypeId; state.Description = this.Description; state.ParentDocumentTypeId = this.ParentDocumentTypeId; 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(IDocumentTypeStateCreated stateCreated) { var aggregateId = stateCreated.DocumentTypeEventId.DocumentTypeId; var state = new DocumentTypeState(); state.DocumentTypeId = aggregateId; var aggregate = (DocumentTypeAggregate)GetDocumentTypeAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public static CreateDocumentType ToCreateDocumentType(this DocumentTypeState state) { return(state.ToCreateDocumentType <CreateDocumentType>()); }
public static MergePatchDocumentType ToMergePatchDocumentType(this DocumentTypeState state) { return(state.ToMergePatchDocumentType <MergePatchDocumentType>()); }
public static DeleteDocumentType ToDeleteDocumentType(this DocumentTypeState state) { return(state.ToDeleteDocumentType <DeleteDocumentType>()); }
public static IDocumentTypeCommand ToCreateOrMergePatchDocumentType(this DocumentTypeState state) { return(state.ToCreateOrMergePatchDocumentType <CreateDocumentType, MergePatchDocumentType>()); }