Exemplo n.º 1
0
        public static TSqlScript GetSqlFragment(string tSql, string sqlHash, int timeoutSeconds = 7)
        {
            var runner = TimedRunner.RunWithTimeout(() => getSqlFragment(tSql, sqlHash), timeoutSeconds);

            if (runner.IsTimedOut)
            {
                throw new TimeoutException(string.Format("Timed out parsing SqlFragment:{0}{1}", Environment.NewLine, tSql));
            }

            return(runner.Result);
        }
Exemplo n.º 2
0
        public static TSqlScript GetSqlFragment(string tSql, string sqlHash, int timeoutSeconds = 7, bool readFromCache = true)
        {
            var runner = TimedRunner.RunWithTimeout(() =>
            {
                try
                {
                    return(getSqlFragment(tSql, sqlHash, readFromCache));
                }
                catch (Exception ex)
                {
                    new ExceptionLogger().LogExceptionToFile(ex, AppMessenger.LogFile);
                    DispatcherHelper.DispatchAction(() => AppMessenger.Messenger.NotifyColleagues("ShowException", ex));
                    return(null);
                }
            }, timeoutSeconds);

            if (runner.IsTimedOut)
            {
                throw new TimeoutException(string.Format("Timed out parsing SqlFragment:{0}{1}",
                                                         Environment.NewLine, tSql));
            }

            return(runner.Result);
        }