private async Task AutoUpdateFeed(System.Timers.Timer timernew) { await Task.Factory.StartNew(() => { var currentDatetime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")); var time = currentDatetime.ToString("hh:mm tt"); try { var feedMgr = IoC.Initialize().GetInstance <IFeedMgr>(); using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new System.TimeSpan(0, 30, 0))) { using (NewsContext _context = new NewsContext()) { Transaction rootTr = Transaction.Current; var itemFeeds = _context.FeedNames; var rssFeeds = _context.NewsItems; foreach (var itemUrl in itemFeeds) { DependentTransaction dt = rootTr.DependentClone(DependentCloneOption.RollbackIfNotComplete); var rssData = feedMgr.ParseFeedUrl(itemUrl.Url, false); _newsFeedMgr.Save(rssData); dt.Complete(); } _context.Dispose(); } scope.Complete(); } timernew.Start(); } catch (Exception ex) { throw ex; } }); }
protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public virtual void Dispose() { if (Disposed) { return; } _BaseDb?.Dispose(); Disposed = true; }
public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { newsContext.Dispose(); } this.disposed = true; } }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { context.Dispose(); } } this.disposed = true; }
public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { db.Dispose(); } this.disposed = true; } }
protected void Dispose(bool disposing) { if (disposed) { return; } if (disposing && context != null) { context.Dispose(); context = null; disposed = true; } }
public void Dispose() { _newsContext?.Dispose(); }
public void Dispose() { _context.Database.EnsureDeleted(); _context.Dispose(); }
public void Dispose() { db.Dispose(); GC.SuppressFinalize(this); }