Example #1
0
        /// <summary>
        /// Execute domain event
        /// </summary>
        /// <param name="domainEvent">Domain event</param>
        /// <returns>Return domain event execute result</returns>
        public DomainEventExecuteResult Execute(IDomainEvent domainEvent)
        {
            if (ExecuteEventOperation == null)
            {
                return(DomainEventExecuteResult.EmptyResult("Did't set any event operation"));
            }
            var eventData = domainEvent as TEvent;

            if (eventData == null)
            {
                return(DomainEventExecuteResult.EmptyResult("Event data is null"));
            }
            return(ExecuteEventOperation(eventData));
        }
Example #2
0
        public async Task <DomainEventExecuteResult> ExecuteAsync(IDomainEvent domainEvent)
        {
            if (ExecuteEventOperationAsync == null)
            {
                return(DomainEventExecuteResult.EmptyResult("did't set any event operation"));
            }
            var eventData = domainEvent as Event;

            if (eventData == null)
            {
                return(DomainEventExecuteResult.EmptyResult("event data is null"));
            }
            return(await ExecuteEventOperationAsync(eventData).ConfigureAwait(false));
        }