private void Apply(LocationCreatedEvent e) { Id = e.Id; _streetAddress = e.StreetAddress; _city = e.City; _state = e.State; _postalCode = e.PostalCode; }
//public void AssignResource(Resource resource) //{ // if (ResourceLocations == null) // ResourceLocations = new List<ResourceLocation>(); // ResourceLocation resourceLocation = new ResourceLocation(resource, this); // this.ResourceLocations.Add(resourceLocation); //} #endregion #region [ Apply event methods ] public void Apply(LocationCreatedEvent message) { this.Name = message.Name; this.Description = message.Description; this.ContactInformation = new ContactInformation(message.ContactName, message.PrimaryTelephone, message.SecondaryTelephone, message.EmailAddress); this.SiteId = message.SiteId; }
private void OnLocationCreated(LocationCreatedEvent locationCreatedEvent) { Id = locationCreatedEvent.Id; locationName = new LocationName(locationCreatedEvent.LocationName); address = new Address(locationCreatedEvent.StreetNumber, locationCreatedEvent.Street, locationCreatedEvent.City, locationCreatedEvent.PostalCode); map = new LocationMap(new Uri(locationCreatedEvent.Map)); locationContact = new LocationContact( new ContactName(locationCreatedEvent.ContactName), new EmailAddress(locationCreatedEvent.ContactEmail), new PhoneNumber(locationCreatedEvent.ContactPhoneNumber)); }
private async Task RaiseLocationCreatedEvent(LocationWriter locationWriter, CancellationToken cancellationToken) { var e = new LocationCreatedEvent(locationWriter) { AggregateId = locationWriter.Id.ToString(), Aggregate = nameof(LocationWriter), MajorVersion = 1, MinorVersion = 1, Name = locationWriter.Name }; await _mediator.Publish(e, cancellationToken); }
public Location(Guid id, int locationId, string streetAddress, string city, string state, string postalCode) { Id = id; _locationId = locationId; _streetAddress = streetAddress; _city = city; _state = state; _postalCode = postalCode; _employees = new List <int>(); // todo Raise Event var locationCreatedEvent = new LocationCreatedEvent(Id, locationId, streetAddress, city, state, postalCode); ApplyChange(locationCreatedEvent); }
public void Apply(LocationCreatedEvent aggregateEvent) { Name = aggregateEvent.Name; }