< Summary

Information
Class: Elsa.Persistence.EFCore.Modules.Tenants.EFCoreTenantStore
Assembly: Elsa.Persistence.EFCore
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Tenants/TenantStore.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 54
Line coverage: 0%
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%210%
FindAsync()100%210%
FindAsync()100%210%
FindManyAsync()100%210%
ListAsync()100%210%
AddAsync()100%210%
UpdateAsync()100%210%
DeleteAsync()100%210%
DeleteAsync()100%210%
Filter(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Tenants/TenantStore.cs

#LineLine coverage
 1using Elsa.Common.Multitenancy;
 2using Elsa.Tenants;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Persistence.EFCore.Modules.Tenants;
 6
 7[UsedImplicitly]
 08public class EFCoreTenantStore(EntityStore<TenantsElsaDbContext, Tenant> store) : ITenantStore
 9{
 10    public async Task<Tenant?> FindAsync(TenantFilter filter, CancellationToken cancellationToken = default)
 11    {
 012        return await store.FindAsync(query => Filter(query, filter), cancellationToken);
 013    }
 14
 15    public async Task<Tenant?> FindAsync(string id, CancellationToken cancellationToken = default)
 16    {
 017        var filter = TenantFilter.ById(id);
 018        return await FindAsync(filter, cancellationToken);
 019    }
 20
 21    public async Task<IEnumerable<Tenant>> FindManyAsync(TenantFilter filter, CancellationToken cancellationToken = defa
 22    {
 023        return await store.QueryAsync(queryable => Filter(queryable, filter), cancellationToken);
 024    }
 25
 26    public async Task<IEnumerable<Tenant>> ListAsync(CancellationToken cancellationToken = default)
 27    {
 028        return await store.ListAsync(cancellationToken);
 029    }
 30
 31    public async Task AddAsync(Tenant tenant, CancellationToken cancellationToken = default)
 32    {
 033        await store.AddAsync(tenant, cancellationToken);
 034    }
 35
 36    public async Task UpdateAsync(Tenant tenant, CancellationToken cancellationToken = default)
 37    {
 038        await store.UpdateAsync(tenant, cancellationToken);
 039    }
 40
 41    public async Task<bool> DeleteAsync(string id, CancellationToken cancellationToken = default)
 42    {
 043        var filter = TenantFilter.ById(id);
 044        var count = await DeleteAsync(filter, cancellationToken);
 045        return count > 0;
 046    }
 47
 48    public async Task<long> DeleteAsync(TenantFilter filter, CancellationToken cancellationToken = default)
 49    {
 050        return await store.DeleteWhereAsync(query => Filter(query, filter), cancellationToken);
 051    }
 52
 053    private static IQueryable<Tenant> Filter(IQueryable<Tenant> query, TenantFilter filter) => filter.Apply(query);
 54}