Exemple #1
0
 private static void Exect(this IStreamExectContext context, long id, Action <long> action)
 {
     try {
         if (!context.OnWillStart(id))
         {
             return;
         }
         action.Invoke(id);
     }
     catch (Exception e) {
         context.OnException(e);
     }
     finally {
         context.OnDidStart(id);
     }
 }
Exemple #2
0
        private static bool TryComplite(this IStreamExectContext context, Func <BinaryBloc> action)
        {
            try {
                var bloc = action?.Invoke();

                if (context.OnComplite(bloc) || bloc == null)
                {
                    return(false);
                }
            }
            catch (Exception e) {
                context?.OnException(e);
                return(false);
            }

            return(true);
        }