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); }
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); }
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); }
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); }