示例#1
0
文件: Feed.cs 项目: grimmi/myrss
 public void SaveItemsToDatabase(IEnumerable <FeedItem> items)
 {
     using (var db = new FeedModelContainer())
     {
         DbgHelper.CurrentNumberOfFeeds("Beginn von SaveItemsToDatabase");
         var itemUIds = db.FeedItems.Where(i => i.Feed.Id == this.Id).Select(i => i.UId).ToList <string>();
         foreach (var item in items)
         {
             try
             {
                 if (!itemUIds.Contains(item.UId))
                 {
                     db.FeedItems.Add(item);
                 }
             }
             catch (DbEntityValidationException dbValEx)
             {
                 logger.ErrorException(">>>>>>>>>>>", dbValEx);
             }
         }
         DbgHelper.CurrentNumberOfFeeds("Vor db.SaveChanges");
         db.SaveChanges();
         DbgHelper.CurrentNumberOfFeeds("Nach db.SaveChanges");
     }
 }
示例#2
0
文件: Feed.cs 项目: grimmi/myrss
 /// <summary>
 /// Setzt das letzte Update des Feeds auf den aktuellen Zeitpunkt (sollte in Event geändert werden)
 /// </summary>
 public void UpdateFeed()
 {
     using (var db = new FeedModelContainer())
     {
         DbgHelper.CurrentNumberOfFeeds("Beginn von UpdateFeed");
         var feed = db.Feeds.Where(f => f.Id == this.Id).FirstOrDefault();
         if (feed != null)
         {
             DbgHelper.CurrentNumberOfFeeds("Feed gefunden");
             feed.LastUpdated = DateTime.Now;
             db.SaveChanges();
             DbgHelper.CurrentNumberOfFeeds("Nach db.SaveChanges");
         }
     }
 }