diff options
author | crupest <crupest@outlook.com> | 2021-04-27 18:38:26 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-27 18:38:26 +0800 |
commit | 6c9778b55dd8367d38280c66e0f308c5332029ed (patch) | |
tree | b59aaf0194103af93c5a0c5e4e8bfd1b414ac201 /BackEnd/Timeline/Services/Data/DataManagerExtensions.cs | |
parent | a341819711cda358652ad84b1e507d9559ecabfd (diff) | |
download | timeline-6c9778b55dd8367d38280c66e0f308c5332029ed.tar.gz timeline-6c9778b55dd8367d38280c66e0f308c5332029ed.tar.bz2 timeline-6c9778b55dd8367d38280c66e0f308c5332029ed.zip |
refactor: Refactor is still on...
Diffstat (limited to 'BackEnd/Timeline/Services/Data/DataManagerExtensions.cs')
-rw-r--r-- | BackEnd/Timeline/Services/Data/DataManagerExtensions.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/BackEnd/Timeline/Services/Data/DataManagerExtensions.cs b/BackEnd/Timeline/Services/Data/DataManagerExtensions.cs index 64d35b9b..d149f3fa 100644 --- a/BackEnd/Timeline/Services/Data/DataManagerExtensions.cs +++ b/BackEnd/Timeline/Services/Data/DataManagerExtensions.cs @@ -1,4 +1,5 @@ using System;
+using System.Threading;
using System.Threading.Tasks;
namespace Timeline.Services.Data
@@ -8,7 +9,7 @@ namespace Timeline.Services.Data /// <summary>
/// Try to get an entry and throw <see cref="DatabaseCorruptedException"/> if not exist.
/// </summary>
- public static async Task<byte[]> GetEntryAndCheck(this IDataManager dataManager, string tag, string notExistMessage)
+ public static async Task<byte[]> GetEntryAndCheck(this IDataManager dataManager, string tag, string notExistMessage, CancellationToken cancellationToken = default)
{
if (dataManager is null)
throw new ArgumentNullException(nameof(dataManager));
@@ -17,7 +18,7 @@ namespace Timeline.Services.Data if (notExistMessage is null)
throw new ArgumentNullException(nameof(notExistMessage));
- var data = await dataManager.GetEntry(tag);
+ var data = await dataManager.GetEntryAsync(tag, cancellationToken);
if (data is null)
throw new DatabaseCorruptedException(string.Format(Resource.GetEntryAndCheckNotExist, tag, notExistMessage));
return data;
|