galaeth-draft/Galaeth.DAL/Repositories/EmailDomainBlacklistRepository.cs

29 lines
1 KiB
C#
Raw Permalink Normal View History

2024-11-17 10:31:01 +01:00
using Dapper;
using Galaeth.Core.Entities;
using Galaeth.Core.Infrastructure;
using Galaeth.Core.RepositoryInterfaces;
using Injectio.Attributes;
namespace Galaeth.DAL.Repositories;
/// <inheritdoc cref="Galaeth.Core.RepositoryInterfaces.IEmailDomainBlacklistRepository" />
[RegisterScoped]
public class EmailDomainBlacklistRepository : BaseRepository<EmailDomainBlacklist, string>, IEmailDomainBlacklistRepository
{
/// <summary>
/// Initializes a new instance of the <see cref="EmailDomainBlacklistRepository"/> class.
/// </summary>
/// <param name="db">Instance of <see cref="IDbConnectionProvider"/>.</param>
public EmailDomainBlacklistRepository(IDbConnectionProvider db)
: base(db)
{
}
/// <inheritdoc cref="Galaeth.Core.RepositoryInterfaces.IEmailDomainBlacklistRepository" />
public async Task<long> CountEntries()
{
return await WithDatabaseAsync(async connection =>
await connection.QueryFirstAsync<long>($"SELECT COUNT(*) FROM {Table};"));
}
}