mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
Swap to dapper Mk. 2
This commit is contained in:
@@ -7,9 +7,7 @@ using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Profiles;
|
||||
|
||||
namespace NzbDrone.Core.CustomFormats
|
||||
@@ -23,7 +21,7 @@ namespace NzbDrone.Core.CustomFormats
|
||||
void Delete(int id);
|
||||
}
|
||||
|
||||
public class CustomFormatService : ICustomFormatService, IHandle<ApplicationStartedEvent>
|
||||
public class CustomFormatService : ICustomFormatService
|
||||
{
|
||||
private readonly ICustomFormatRepository _formatRepository;
|
||||
private readonly IHistoryService _historyService;
|
||||
@@ -59,6 +57,9 @@ namespace NzbDrone.Core.CustomFormats
|
||||
_cache = cacheManager.GetCache<Dictionary<int, CustomFormat>>(typeof(CustomFormat), "formats");
|
||||
_historyService = historyService;
|
||||
_logger = logger;
|
||||
|
||||
// Fill up the cache for subsequent DB lookups
|
||||
All();
|
||||
}
|
||||
|
||||
public void Update(CustomFormat customFormat)
|
||||
@@ -158,7 +159,7 @@ namespace NzbDrone.Core.CustomFormats
|
||||
{
|
||||
return _cache.Get("all", () =>
|
||||
{
|
||||
var all = _formatRepository.All().ToDictionary(m => m.Id);
|
||||
var all = _formatRepository.All().Select(x => (CustomFormat)x).ToDictionary(m => m.Id);
|
||||
AllCustomFormats = all;
|
||||
return all;
|
||||
});
|
||||
@@ -208,11 +209,5 @@ namespace NzbDrone.Core.CustomFormats
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
{
|
||||
// Fillup cache for DataMapper.
|
||||
All();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user