* Initial implementation of workflow inbox, submission and delivery * Implement persistence providers * Update EF Core migrations * Rename Services to Stores in Dapper module * Use default serializer for primitive arrays * Update MongoDB provider to map BookmarkId to be primary key * Implement MongoDB provider for activity execution logs * Use EF Core by default * Fix private JSON constructor logic
34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using Elsa.Mediator.Contracts;
|
|
using Elsa.Workflows.Runtime.Contracts;
|
|
using Elsa.Workflows.Runtime.Filters;
|
|
using Elsa.Workflows.Runtime.Notifications;
|
|
|
|
namespace Elsa.Workflows.Runtime.Services;
|
|
|
|
/// <summary>
|
|
/// Default implementation of <see cref="IBookmarkManager"/>.
|
|
/// </summary>
|
|
public class DefaultBookmarkManager : IBookmarkManager
|
|
{
|
|
private readonly IBookmarkStore _bookmarkStore;
|
|
private readonly INotificationSender _notificationSender;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="DefaultBookmarkManager"/> class.
|
|
/// </summary>
|
|
public DefaultBookmarkManager(IBookmarkStore bookmarkStore, INotificationSender notificationSender)
|
|
{
|
|
_bookmarkStore = bookmarkStore;
|
|
_notificationSender = notificationSender;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public async Task<long> DeleteManyAsync(BookmarkFilter filter, CancellationToken cancellationToken = default)
|
|
{
|
|
var bookmarks = (await _bookmarkStore.FindManyAsync(filter, cancellationToken)).ToList();
|
|
await _notificationSender.SendAsync(new BookmarksDeleting(bookmarks), cancellationToken);
|
|
var count = await _bookmarkStore.DeleteAsync(filter, cancellationToken);
|
|
await _notificationSender.SendAsync(new BookmarksDeleted(bookmarks), cancellationToken);
|
|
return count;
|
|
}
|
|
} |