예제 #1
0
        public async Task <IResult> InvokeAsync()
        {
            IResult result = await ValidateAsync();

            if (!result.Success)
            {
                return(result);
            }

            result = await RunAsync(this.ToCommandActions());

            if (result.Success)
            {
                return(result);
            }

            var rollback = await RunAsync(this.ToRollbackActions());

            foreach (var message in rollback.Messages)
            {
                result.AddMessage(message);
            }

            return(result);
        }
예제 #2
0
 public static IResult CopyMessages(this IResult result, IResult copyMessageResult)
 {
     if (copyMessageResult == null)
     {
         return(result);
     }
     foreach (var resultMessage in copyMessageResult.ResultMessages)
     {
         result.AddMessage(resultMessage);
     }
     return(result);
 }
예제 #3
0
 public static IResult <TEntity1> CopyMessages <TEntity1, TEntity2>(this IResult <TEntity1> result, IResult <TEntity2> copyMessageResult)
 {
     if (copyMessageResult == null)
     {
         return(result);
     }
     foreach (var resultMessage in copyMessageResult.ResultMessages)
     {
         result.AddMessage(resultMessage);
     }
     return(result);
 }
예제 #4
0
        public IResult Invoke()
        {
            IResult result = Validate();

            if (!result.Success)
            {
                return(result);
            }

            result = Run(this.ToCommandActions());
            if (result.Success)
            {
                return(result);
            }

            var rollback = Run(this.ToRollbackActions());

            foreach (var message in rollback.Messages)
            {
                result.AddMessage(message);
            }

            return(result);
        }