From 2cbcd8b63bcd7e3d45cd92baa5bacd828527aea8 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 27 Apr 2021 18:38:26 +0800 Subject: refactor: Refactor is still on... --- BackEnd/Timeline/Services/Data/DataManagerExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'BackEnd/Timeline/Services/Data/DataManagerExtensions.cs') 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 /// /// Try to get an entry and throw if not exist. /// - public static async Task GetEntryAndCheck(this IDataManager dataManager, string tag, string notExistMessage) + public static async Task 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; -- cgit v1.2.3