void updateDbtimer_Elapsed(object sender, ElapsedEventArgs e) { try { var loadxml = new LoadDbConfigXml(Xmlpath); this._msDbAccessor.UpdateTables(loadxml.GeTableInfos()); } catch (Exception ex) { throw new Exception(string.Format(" initialization MsDbAccessor is error {0}", ex.StackTrace)); } }
private const int Interval = 1000 * 60 * 60; // 一个小时 public SeclureCloudStorge() { var loadxml = new LoadDbConfigXml(Xmlpath); var updateDbtimer = new Timer(Interval); try { this._msDbAccessor = new MsDbAccessor(loadxml.GetSqlConnectionStrings()); this._msDbAccessor.UpdateTables(loadxml.GeTableInfos()); updateDbtimer.Elapsed += this.updateDbtimer_Elapsed; updateDbtimer.Start(); } catch (Exception ex) { throw new Exception(string.Format(" initialization MsDbAccessor is error {0}", ex.StackTrace)); } }