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 | 2cbcd8b63bcd7e3d45cd92baa5bacd828527aea8 (patch) | |
tree | 36ef7044778eb0f660d02d08b57c4d0a143b9865 /BackEnd/Timeline/Services/Data/DataManagerExtensions.cs | |
parent | deb02d10e6139bb74a63343e2a8b70fee11bec22 (diff) | |
download | timeline-2cbcd8b63bcd7e3d45cd92baa5bacd828527aea8.tar.gz timeline-2cbcd8b63bcd7e3d45cd92baa5bacd828527aea8.tar.bz2 timeline-2cbcd8b63bcd7e3d45cd92baa5bacd828527aea8.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;
|