aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/DataManager.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-13 22:27:29 +0800
committercrupest <crupest@outlook.com>2021-02-13 22:27:29 +0800
commit780d19611549182e7f8cbebdb05498f33a8e1de0 (patch)
tree1c932c04b03c7497e61d2a6f34cbc20db32d02af /BackEnd/Timeline/Services/DataManager.cs
parentd22f85818c9257839b093a6fd299f0ea00a075fa (diff)
downloadtimeline-780d19611549182e7f8cbebdb05498f33a8e1de0.tar.gz
timeline-780d19611549182e7f8cbebdb05498f33a8e1de0.tar.bz2
timeline-780d19611549182e7f8cbebdb05498f33a8e1de0.zip
fix: No longer able to not save change in data manager.
Diffstat (limited to 'BackEnd/Timeline/Services/DataManager.cs')
-rw-r--r--BackEnd/Timeline/Services/DataManager.cs16
1 files changed, 6 insertions, 10 deletions
diff --git a/BackEnd/Timeline/Services/DataManager.cs b/BackEnd/Timeline/Services/DataManager.cs
index b697630c..b43b80f9 100644
--- a/BackEnd/Timeline/Services/DataManager.cs
+++ b/BackEnd/Timeline/Services/DataManager.cs
@@ -22,22 +22,20 @@ namespace Timeline.Services
/// increases its ref count and returns a tag to the entry.
/// </summary>
/// <param name="data">The data. Can't be null.</param>
- /// <param name="saveDatabaseChange">If true save database change. Otherwise it does not save database change.</param>
/// <returns>The tag of the created entry.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="data"/> is null.</exception>
- public Task<string> RetainEntry(byte[] data, bool saveDatabaseChange = true);
+ public Task<string> RetainEntry(byte[] data);
/// <summary>
/// Decrease the the ref count of the entry.
/// Remove it if ref count is zero.
/// </summary>
/// <param name="tag">The tag of the entry.</param>
- /// <param name="saveDatabaseChange">If true save database change. Otherwise it does not save database change.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="tag"/> is null.</exception>
/// <remarks>
/// It's no-op if entry with tag does not exist.
/// </remarks>
- public Task FreeEntry(string tag, bool saveDatabaseChange = true);
+ public Task FreeEntry(string tag);
/// <summary>
/// Retrieve the entry with given tag. If not exist, returns null.
@@ -59,7 +57,7 @@ namespace Timeline.Services
_eTagGenerator = eTagGenerator;
}
- public async Task<string> RetainEntry(byte[] data, bool saveDatabaseChange = true)
+ public async Task<string> RetainEntry(byte[] data)
{
if (data == null)
throw new ArgumentNullException(nameof(data));
@@ -83,13 +81,12 @@ namespace Timeline.Services
entity.Ref += 1;
}
- if (saveDatabaseChange)
- await _database.SaveChangesAsync();
+ await _database.SaveChangesAsync();
return tag;
}
- public async Task FreeEntry(string tag, bool saveDatabaseChange)
+ public async Task FreeEntry(string tag)
{
if (tag == null)
throw new ArgumentNullException(nameof(tag));
@@ -107,8 +104,7 @@ namespace Timeline.Services
entity.Ref -= 1;
}
- if (saveDatabaseChange)
- await _database.SaveChangesAsync();
+ await _database.SaveChangesAsync();
}
}