/// <summary> /// Remove /// </summary> public virtual void Remove() { repository.Remove((T)this); DomainEventBus.Publish(new DefaultAggregationRemoveDomainEvent <T>() { Object = this as T }); }
/// <summary> /// Remove /// </summary> public virtual Result Remove() { if (IdentityValueIsNone()) { throw new EZNEWException("The object does not have an identity value set and cannot perform a remove"); } T removeData = this as T; repository.Remove(removeData); DomainEventBus.Publish(new DefaultAggregationRemoveDomainEvent <T>() { Object = removeData }); return(Result.SuccessResult("Data removed successfully")); }