Example #1
0
        public virtual ILocatorTypeState ToLocatorTypeState()
        {
            var state = new LocatorTypeState(true);

            state.LocatorTypeId = this.LocatorTypeId;
            state.Description   = this.Description;
            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);
        }
Example #2
0
        public virtual void Initialize(ILocatorTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.LocatorTypeEventId.LocatorTypeId;
            var state       = new LocatorTypeState();

            state.LocatorTypeId = aggregateId;
            var aggregate = (LocatorTypeAggregate)GetLocatorTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
 public static CreateLocatorType ToCreateLocatorType(this LocatorTypeState state)
 {
     return(state.ToCreateLocatorType <CreateLocatorType>());
 }
 public static MergePatchLocatorType ToMergePatchLocatorType(this LocatorTypeState state)
 {
     return(state.ToMergePatchLocatorType <MergePatchLocatorType>());
 }
 public static DeleteLocatorType ToDeleteLocatorType(this LocatorTypeState state)
 {
     return(state.ToDeleteLocatorType <DeleteLocatorType>());
 }
 public static ILocatorTypeCommand ToCreateOrMergePatchLocatorType(this LocatorTypeState state)
 {
     return(state.ToCreateOrMergePatchLocatorType <CreateLocatorType, MergePatchLocatorType>());
 }