Changed all Single<T> to SingleOrDefault<T>

This commit is contained in:
Mark McDowall 2011-06-18 12:56:17 -07:00
parent 7d1f0d2c08
commit a771d2cfa9
4 changed files with 6 additions and 6 deletions

View File

@ -34,17 +34,17 @@ namespace NzbDrone.Core.Providers
public virtual Episode GetEpisode(long id)
{
return _database.Single<Episode>(id);
return _database.SingleOrDefault<Episode>(id);
}
public virtual Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber)
{
return _database.Single<Episode>("WHERE SeriesId = @0 AND SeasonNumber = @1 AND EpisodeNumber = @2", seriesId, seasonNumber, episodeNumber);
return _database.SingleOrDefault<Episode>("WHERE SeriesId = @0 AND SeasonNumber = @1 AND EpisodeNumber = @2", seriesId, seasonNumber, episodeNumber);
}
public virtual Episode GetEpisode(int seriesId, DateTime date)
{
return _database.Single<Episode>("WHERE SeriesId = @0 AND AirDate = @1", seriesId, date.Date);
return _database.SingleOrDefault<Episode>("WHERE SeriesId = @0 AND AirDate = @1", seriesId, date.Date);
}
public virtual IList<Episode> GetEpisodeBySeries(long seriesId)

View File

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Providers
public virtual IndexerSetting GetSettings(Type type)
{
return _database.Single<IndexerSetting>("WHERE IndexProviderType = @0", type.ToString());
return _database.SingleOrDefault<IndexerSetting>("WHERE IndexProviderType = @0", type.ToString());
}
public virtual void InitializeIndexers(IList<IndexerBase> indexers)

View File

@ -196,7 +196,7 @@ namespace NzbDrone.Core.Providers
public virtual EpisodeFile GetEpisodeFile(int episodeFileId)
{
return _database.Single<EpisodeFile>(episodeFileId);
return _database.SingleOrDefault<EpisodeFile>(episodeFileId);
}
public virtual List<EpisodeFile> GetEpisodeFiles()

View File

@ -53,7 +53,7 @@ namespace NzbDrone.Core.Providers
public virtual QualityProfile Get(int profileId)
{
return _database.Single<QualityProfile>(profileId);
return _database.SingleOrDefault<QualityProfile>(profileId);
}
public virtual void SetupDefaultProfiles()