} // protected modifier on set needed by nhibernate // - cannot be private public virtual void UpdateData(string name, decimal tonnage) { Name = name; Tonnage = tonnage; DomainEvents.RaiseEvent(new ShipUpdatedDomainEvent { ShipId = Id }); }
public virtual void OnCreationCompleted() { if (Id == default(int)) { throw new Exception("Id has not been assigned yet - entity creation has not been completed yet"); } DomainEvents.RaiseEvent(new ShipCreatedDomainEvent { ShipId = Id }); }
public virtual void AddShipCargoPolicyItem(ShipCargoPolicyItemArgs args) { var shipCargoPolicyItem = new ShipCargoPolicyItem(args); _items.Add(shipCargoPolicyItem); DomainEvents.RaiseEvent(new ShipCargoPolicyItemAddedDomainEvent { PolicyId = Id, ShipId = args.Ship.Id }); }
public virtual void EnqueueEmailToBeSent(string fromAddress, HashSet <Recipient> recipients, string subject) { Guard.Hope(State.CanSend, "cannot enqeue email in the current state: " + State.Name); Guard.Hope(_emailRecipients.Count == 0, "recipients must be empty"); State = EmailState.ToBeSent; FromAddress = fromAddress; Subject = subject; recipients.Each(r => _emailRecipients.Add(new EmailRecipient(this, r))); DomainEvents.RaiseEvent(new EmailEnqueuedToBeSentDomainEvent { EmailId = Id }); }
public virtual void BehaviouralMethodWithRaisingDomainEvent() { DomainEvents.RaiseEvent(new TestDomainEvent()); }