Пример #1
0
 private void ExecuteNonQuery(Func <DbCommand> createCommand, string errorMessage)
 {
     _executor.Execute(() =>
     {
         try
         {
             createCommand().ExecuteNonQuery();
         }
         catch (Exception ex)
         {
             Logger.Error(errorMessage, ex);
             throw;
         }
     });
 }
        private IEnumerable <ProductCoPurchasePrediction> ExecuteQuery(Func <DbCommand> createCommand)
        {
            IDatabaseExecutor db = this.databaseExecutor();

            return(db.Execute(
                       () =>
            {
                try
                {
                    return this.ExecuteEnumerableQuery(createCommand());
                }
                catch (Exception ex)
                {
                    Logger.Error("[Prediction Engine] An error occurred while retrieving predictions.", exception: ex);
                    throw;
                }
            }));
        }
        private void ExecuteNonQuery(Func <DbCommand> createCommand, string errorMessage)
        {
            IDatabaseExecutor db = this.databaseExecutor();

            db.Execute(
                () =>
            {
                try
                {
                    createCommand().ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Logger.Error(message: errorMessage, exception: ex);
                    throw;
                }
            });
        }