Beispiel #1
0
        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);
        }
Beispiel #3
0
 public static CreateDocumentType ToCreateDocumentType(this DocumentTypeState state)
 {
     return(state.ToCreateDocumentType <CreateDocumentType>());
 }
Beispiel #4
0
 public static MergePatchDocumentType ToMergePatchDocumentType(this DocumentTypeState state)
 {
     return(state.ToMergePatchDocumentType <MergePatchDocumentType>());
 }
Beispiel #5
0
 public static DeleteDocumentType ToDeleteDocumentType(this DocumentTypeState state)
 {
     return(state.ToDeleteDocumentType <DeleteDocumentType>());
 }
Beispiel #6
0
 public static IDocumentTypeCommand ToCreateOrMergePatchDocumentType(this DocumentTypeState state)
 {
     return(state.ToCreateOrMergePatchDocumentType <CreateDocumentType, MergePatchDocumentType>());
 }