public static void UpdateAll(string host) { if (host.HasValue()) { HttpRuntime.Cache["testhost"] = host; DbUtil.DbDispose(); } var list = DbUtil.Db.Connection.Query(CodeSql.SqlSavedqueries).ToList(); foreach (var sq in list) { var g = sq.QueryId as Guid?; if (!g.HasValue) { continue; } Debug.WriteLine($"{sq.name}"); DbUtil.DbDispose(); try { var c = DbUtil.Db.LoadExistingQuery(g.Value); var s = c.ToCode(); if (s.HasValue()) { UpdateQueryConditions.Run(sq.QueryId); DbUtil.Db.Connection.Execute(@"UPDATE QueryAnalysis set Updated = 1 where Id = @id", new { id = sq.QueryId }); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } }
public static void Run(Guid id) { var mm = new UpdateQueryConditions(); try { mm.UpdateConditions(id); } // ReSharper disable once EmptyGeneralCatchClause catch (Exception) { } }