| | | 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="IUserStore"/>. |
| | | 9 | | /// </summary> |
| | 1 | 10 | | public class EFCoreUserStore(EntityStore<IdentityElsaDbContext, User> userStore) : IUserStore |
| | | 11 | | { |
| | | 12 | | /// <inheritdoc /> |
| | | 13 | | public async Task SaveAsync(User user, CancellationToken cancellationToken = default) |
| | | 14 | | { |
| | 0 | 15 | | await userStore.SaveAsync(user, cancellationToken); |
| | 0 | 16 | | } |
| | | 17 | | |
| | | 18 | | /// <inheritdoc /> |
| | | 19 | | public async Task DeleteAsync(UserFilter filter, CancellationToken cancellationToken = default) |
| | | 20 | | { |
| | 0 | 21 | | await userStore.DeleteWhereAsync(query => Filter(query, filter), cancellationToken); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc /> |
| | | 25 | | public async Task<User?> FindAsync(UserFilter filter, CancellationToken cancellationToken = default) |
| | | 26 | | { |
| | 0 | 27 | | return await userStore.FindAsync(query => Filter(query, filter), cancellationToken); |
| | 0 | 28 | | } |
| | | 29 | | |
| | 0 | 30 | | private static IQueryable<User> Filter(IQueryable<User> query, UserFilter filter) => filter.Apply(query); |
| | | 31 | | } |