public virtual void Initialize(IContactMechStateCreated stateCreated) { var aggregateId = stateCreated.ContactMechEventId.ContactMechId; var state = new ContactMechState(); state.ContactMechId = aggregateId; var aggregate = (ContactMechAggregate)GetContactMechAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual IContactMechState ToContactMechState() { var state = new ContactMechState(true); state.ContactMechId = this.ContactMechId; state.ContactMechTypeId = this.ContactMechTypeId; state.InfoString = this.InfoString; state.ToName = this.ToName; state.AttnName = this.AttnName; state.Address1 = this.Address1; state.Address2 = this.Address2; state.Directions = this.Directions; state.City = this.City; state.PostalCode = this.PostalCode; state.PostalCodeExt = this.PostalCodeExt; state.CountryGeoId = this.CountryGeoId; state.StateProvinceGeoId = this.StateProvinceGeoId; state.CountyGeoId = this.CountyGeoId; state.PostalCodeGeoId = this.PostalCodeGeoId; state.GeoPointId = this.GeoPointId; state.CountryCode = this.CountryCode; state.AreaCode = this.AreaCode; state.ContactNumber = this.ContactNumber; state.AskForName = this.AskForName; 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 static CreateContactMech ToCreateContactMech(this ContactMechState state) { return(state.ToCreateContactMech <CreateContactMech>()); }
public static MergePatchContactMech ToMergePatchContactMech(this ContactMechState state) { return(state.ToMergePatchContactMech <MergePatchContactMech>()); }
public static DeleteContactMech ToDeleteContactMech(this ContactMechState state) { return(state.ToDeleteContactMech <DeleteContactMech>()); }
public static IContactMechCommand ToCreateOrMergePatchContactMech(this ContactMechState state) { return(state.ToCreateOrMergePatchContactMech <CreateContactMech, MergePatchContactMech>()); }