コード例 #1
0
 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));
     }
 }
コード例 #2
0
        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));
            }
        }