Esempio n. 1
0
 public static ExcuteResult <T> Excute <T>(Func <T> action)
 {
     try
     {
         var result = action();
         return(ExcuteResult <T> .CreateSuccess(result));
     }
     catch (Exception ex)
     {
         return(ex);
     }
 }
Esempio n. 2
0
        public static async Task <ExcuteResult <T> > ExcuteAsync <T>(Func <Task <T> > action)
        {
            try
            {
                var result = await action().DonotCapture();

                return(ExcuteResult <T> .CreateSuccess(result));
            }
            catch (Exception ex)
            {
                return(ex);
            }
        }