示例#1
0
 /// <summary>
 /// Remove self from DB.
 /// </summary>
 public void DeleteFromPersistence()
 {
     lock (this)
     {
         _persistenceHelper.Delete <PlatformComponent>(new MatchExpression("PlatformId", this.Id));
         _persistenceHelper.Delete <Platform>(new MatchExpression("Name", this.Name));
     }
 }
        void PlatformNewsManager_SourceRemovedEvent(NewsManager manager, NewsSource source)
        {
            SystemMonitor.CheckError(_persistenceHelper.Delete <NewsSource>(new NewsSource[] { (source) }), "Failed to delete source from DB.");

            source.PersistenceDataUpdatedEvent -= new GeneralHelper.GenericDelegate <IDBPersistent>(source_PersistenceDataUpdatedEvent);
            source.ItemsAddedEvent             -= new NewsSource.ItemsUpdateDelegate(source_ItemsAddingAcceptEvent);
            source.ItemsUpdatedEvent           -= new NewsSource.ItemsUpdateDelegate(source_ItemsUpdatedEvent);

            _persistenceHelper.Delete <NewsSource>(source);

            _persistenceHelper.Delete <RssNewsItem>(new MatchExpression("NewsSourceId", source.Id));
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        public bool RemoveEntry(DataStoreEntry entry)
        {
            lock (_entriesAndSessions)
            {
                if (_entriesAndSessions.RemoveByKey(entry) == false)
                {
                    return(false);
                }
            }

            lock (this)
            {
                _persistenceHelper.Delete <DataStoreEntry>(entry);
            }

            entry.ClearData();

            if (EntryRemovedEvent != null)
            {
                EntryRemovedEvent(this, entry);
            }

            return(true);
        }