| | | 1 | | using Elsa.Labels.Contracts; |
| | | 2 | | using Elsa.Labels.Entities; |
| | | 3 | | |
| | | 4 | | namespace Elsa.Persistence.EFCore.Modules.Labels; |
| | | 5 | | |
| | | 6 | | /// <inheritdoc /> |
| | | 7 | | public class EFCoreWorkflowDefinitionLabelStore : IWorkflowDefinitionLabelStore |
| | | 8 | | { |
| | | 9 | | private readonly EntityStore<LabelsElsaDbContext, WorkflowDefinitionLabel> _store; |
| | | 10 | | |
| | | 11 | | /// <summary> |
| | | 12 | | /// Constructor |
| | | 13 | | /// </summary> |
| | 0 | 14 | | public EFCoreWorkflowDefinitionLabelStore(EntityStore<LabelsElsaDbContext, WorkflowDefinitionLabel> store) => _store |
| | | 15 | | |
| | | 16 | | /// <inheritdoc /> |
| | 0 | 17 | | public async Task SaveAsync(WorkflowDefinitionLabel record, CancellationToken cancellationToken = default) => await |
| | | 18 | | |
| | | 19 | | /// <inheritdoc /> |
| | 0 | 20 | | public async Task SaveManyAsync(IEnumerable<WorkflowDefinitionLabel> records, CancellationToken cancellationToken = |
| | | 21 | | |
| | | 22 | | /// <inheritdoc /> |
| | 0 | 23 | | public async Task<bool> DeleteAsync(string id, CancellationToken cancellationToken = default) => await _store.Delete |
| | | 24 | | |
| | | 25 | | /// <inheritdoc /> |
| | | 26 | | public async Task<IEnumerable<WorkflowDefinitionLabel>> FindByWorkflowDefinitionVersionIdAsync(string workflowDefini |
| | 0 | 27 | | await _store.FindManyAsync(x => x.WorkflowDefinitionVersionId == workflowDefinitionVersionId, cancellationToken) |
| | | 28 | | |
| | | 29 | | /// <inheritdoc /> |
| | | 30 | | public async Task ReplaceAsync(IEnumerable<WorkflowDefinitionLabel> removed, IEnumerable<WorkflowDefinitionLabel> ad |
| | | 31 | | { |
| | 0 | 32 | | var idList = removed.Select(r => r.Id); |
| | 0 | 33 | | await _store.DeleteWhereAsync(w => idList.Contains(w.Id), cancellationToken); |
| | 0 | 34 | | await _store.SaveManyAsync(added, cancellationToken); |
| | 0 | 35 | | } |
| | | 36 | | |
| | | 37 | | /// <inheritdoc /> |
| | | 38 | | public async Task<long> DeleteByWorkflowDefinitionIdAsync(string workflowDefinitionId, CancellationToken cancellatio |
| | 0 | 39 | | await _store.DeleteWhereAsync(x => x.WorkflowDefinitionId == workflowDefinitionId, cancellationToken); |
| | | 40 | | |
| | | 41 | | /// <inheritdoc /> |
| | | 42 | | public async Task<long> DeleteByWorkflowDefinitionVersionIdAsync(string workflowDefinitionVersionId, CancellationTok |
| | 0 | 43 | | await _store.DeleteWhereAsync(x => x.WorkflowDefinitionVersionId == workflowDefinitionVersionId, cancellationTok |
| | | 44 | | |
| | | 45 | | /// <inheritdoc /> |
| | | 46 | | public async Task<long> DeleteByWorkflowDefinitionIdsAsync(IEnumerable<string> workflowDefinitionIds, CancellationTo |
| | | 47 | | { |
| | 0 | 48 | | var ids = workflowDefinitionIds.ToList(); |
| | 0 | 49 | | return await _store.DeleteWhereAsync(x => ids.Contains(x.WorkflowDefinitionId), cancellationToken); |
| | 0 | 50 | | } |
| | | 51 | | |
| | | 52 | | /// <inheritdoc /> |
| | | 53 | | public async Task<long> DeleteByWorkflowDefinitionVersionIdsAsync(IEnumerable<string> workflowDefinitionVersionIds, |
| | | 54 | | { |
| | 0 | 55 | | var ids = workflowDefinitionVersionIds.ToList(); |
| | 0 | 56 | | return await _store.DeleteWhereAsync(x => ids.Contains(x.WorkflowDefinitionVersionId), cancellationToken); |
| | 0 | 57 | | } |
| | | 58 | | } |