| | | 1 | | using Elsa.Identity.Contracts; |
| | | 2 | | using Elsa.Identity.Entities; |
| | | 3 | | using Elsa.Identity.Models; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Persistence.EFCore.Modules.Identity; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// An EF Core implementation of <see cref="IApplicationStore"/>. |
| | | 9 | | /// </summary> |
| | | 10 | | public class EFCoreApplicationStore : IApplicationStore |
| | | 11 | | { |
| | | 12 | | private readonly EntityStore<IdentityElsaDbContext, Application> _applicationStore; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Initializes a new instance of <see cref="EFCoreApplicationStore"/>. |
| | | 16 | | /// </summary> |
| | 1 | 17 | | public EFCoreApplicationStore(EntityStore<IdentityElsaDbContext, Application> applicationStore) |
| | | 18 | | { |
| | 1 | 19 | | _applicationStore = applicationStore; |
| | 1 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <inheritdoc /> |
| | | 23 | | public async Task SaveAsync(Application application, CancellationToken cancellationToken = default) |
| | | 24 | | { |
| | 0 | 25 | | await _applicationStore.SaveAsync(application, cancellationToken); |
| | 0 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <inheritdoc /> |
| | | 29 | | public async Task DeleteAsync(ApplicationFilter filter, CancellationToken cancellationToken = default) |
| | | 30 | | { |
| | 0 | 31 | | await _applicationStore.DeleteWhereAsync(query => Filter(query, filter), cancellationToken); |
| | 0 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <inheritdoc /> |
| | | 35 | | public async Task<Application?> FindAsync(ApplicationFilter filter, CancellationToken cancellationToken = default) |
| | | 36 | | { |
| | 0 | 37 | | return await _applicationStore.FindAsync(query => Filter(query, filter), cancellationToken); |
| | 0 | 38 | | } |
| | | 39 | | |
| | 0 | 40 | | private static IQueryable<Application> Filter(IQueryable<Application> query, ApplicationFilter filter) => filter.App |
| | | 41 | | } |