public bool has_run_script_already(string script_name) { ScriptsRun script = get_from_script_cache(script_name); if (script != null) { return(true); } bool script_has_run = false; QueryOver <ScriptsRun> crit = QueryOver.Of <ScriptsRun>() .Where(x => x.script_name == script_name) .OrderBy(x => x.id).Desc .Take(1); try { IList <ScriptsRun> items = repository.get_with_criteria(crit); if (items != null && items.Count > 0) { script_has_run = true; } } catch (Exception ex) { Log.bound_to(this).log_an_error_event_containing( "{0} with provider {1} does not provide a facility for determining if a script has run at this time.{2}{3}", GetType(), provider, Environment.NewLine, ex.Message); throw; } return(script_has_run); }
public string get_current_script_hash(string script_name) { ScriptsRun script = get_from_script_cache(script_name); if (script != null) { return(script.text_hash); } QueryOver <ScriptsRun> crit = QueryOver.Of <ScriptsRun>() .Where(x => x.script_name == script_name) .OrderBy(x => x.id).Desc .Take(1); string hash = string.Empty; try { IList <ScriptsRun> items = repository.get_with_criteria(crit); if (items != null && items.Count > 0) { hash = items[0].text_hash; } } catch (Exception ex) { Log.bound_to(this).log_an_error_event_containing( "{0} with provider {1} does not provide a facility for hashing (through recording scripts run) at this time.{2}{3}", GetType(), provider, Environment.NewLine, ex.Message); throw; } return(hash); }
protected ScriptsRun get_script_run(string script_name) { QueryOver <ScriptsRun> criteria = QueryOver.Of <ScriptsRun>() .Where(x => x.script_name == script_name) .OrderBy(x => x.id).Desc .Take(1); ScriptsRun script = null; IList <ScriptsRun> found_items; try { found_items = retry_policy.ExecuteAction(() => repository.get_with_criteria(criteria)); } catch (Exception ex) { Log.bound_to(this).log_an_error_event_containing( "{0} with provider {1} does not provide a facility for recording scripts run this time.{2}{3}", GetType(), provider, Environment.NewLine, ex.to_string()); throw; } if (found_items != null && found_items.Count > 0) { script = found_items[0]; } return(script); }
public void insert_script_run(string script_name, string sql_to_run, string sql_to_run_hash, bool run_this_script_once, long version_id) { ScriptsRun script_run = new ScriptsRun { version_id = version_id, script_name = script_name, text_of_script = sql_to_run, text_hash = sql_to_run_hash, one_time_script = run_this_script_once }; try { repository.save_or_update(script_run); } catch (Exception ex) { Log.bound_to(this).log_an_error_event_containing( "{0} with provider {1} does not provide a facility for recording scripts run at this time.{2}{3}", GetType(), provider, Environment.NewLine, ex.Message); throw; } }
public bool has_run_script_already(string script_name) { ScriptsRun script = get_from_script_cache(script_name) ?? get_script_run(script_name); return(script != null); }
public string get_current_script_hash(string script_name) { ScriptsRun script = get_from_script_cache(script_name) ?? get_script_run(script_name); return(script != null ? script.text_hash : string.Empty); }