< Summary

Information
Class: Elsa.Persistence.EFCore.Modules.Identity.EFCoreRoleStore
Assembly: Elsa.Persistence.EFCore
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Identity/RoleStore.cs
Line coverage
21%
Covered lines: 3
Uncovered lines: 11
Coverable lines: 14
Total lines: 54
Line coverage: 21.4%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
SaveAsync()100%210%
AddAsync()100%210%
DeleteAsync()100%210%
FindAsync()100%210%
FindManyAsync()100%210%
Filter(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Identity/RoleStore.cs

#LineLine coverage
 1using Elsa.Identity.Contracts;
 2using Elsa.Identity.Entities;
 3using Elsa.Identity.Models;
 4using Open.Linq.AsyncExtensions;
 5
 6namespace Elsa.Persistence.EFCore.Modules.Identity;
 7
 8/// <summary>
 9/// An EF Core implementation of <see cref="IRoleStore"/>.
 10/// </summary>
 11public class EFCoreRoleStore : IRoleStore
 12{
 13    private readonly EntityStore<IdentityElsaDbContext, Role> _applicationStore;
 14
 15    /// <summary>
 16    /// Initializes a new instance of <see cref="EFCoreRoleStore"/>.
 17    /// </summary>
 118    public EFCoreRoleStore(EntityStore<IdentityElsaDbContext, Role> applicationStore)
 19    {
 120        _applicationStore = applicationStore;
 121    }
 22
 23    /// <inheritdoc />
 24    public async Task SaveAsync(Role application, CancellationToken cancellationToken = default)
 25    {
 026        await _applicationStore.SaveAsync(application, cancellationToken);
 027    }
 28
 29    /// <inheritdoc />
 30    public async Task AddAsync(Role role, CancellationToken cancellationToken = default)
 31    {
 032        await _applicationStore.AddAsync(role, cancellationToken);
 033    }
 34
 35    /// <inheritdoc />
 36    public async Task DeleteAsync(RoleFilter filter, CancellationToken cancellationToken = default)
 37    {
 038        await _applicationStore.DeleteWhereAsync(query => Filter(query, filter), cancellationToken);
 039    }
 40
 41    /// <inheritdoc />
 42    public async Task<Role?> FindAsync(RoleFilter filter, CancellationToken cancellationToken = default)
 43    {
 044        return await _applicationStore.FindAsync(query => Filter(query, filter), cancellationToken);
 045    }
 46
 47    /// <inheritdoc />
 48    public async Task<IEnumerable<Role>> FindManyAsync(RoleFilter filter, CancellationToken cancellationToken = default)
 49    {
 050        return await _applicationStore.QueryAsync(queryable => Filter(queryable, filter), cancellationToken).ToList();
 051    }
 52
 053    private static IQueryable<Role> Filter(IQueryable<Role> query, RoleFilter filter) => filter.Apply(query);
 54}