-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SingleEphemeral + breaking change: remove name from CleanupSelfAsync
- Loading branch information
1 parent
2850d95
commit daf74d1
Showing
5 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Ephemerally; | ||
|
||
public sealed class SingleEphemeral<T> : Ephemeral<T> where T : class | ||
{ | ||
private readonly Func<Task> _cleanupSelfAsync; | ||
|
||
public SingleEphemeral( | ||
T value, | ||
Func<Task> cleanupSelfAsync) | ||
: base(value, x => string.Empty, new EphemeralOptions { CleanupBehavior = CleanupBehavior.SelfOnly }) | ||
{ | ||
_cleanupSelfAsync = cleanupSelfAsync; | ||
} | ||
|
||
protected override Task CleanupSelfAsync() => _cleanupSelfAsync(); | ||
|
||
protected override Task CleanupAllAsync() => Task.CompletedTask; | ||
} |