33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
// <copyright file="EmailDomainBlacklistRepository.cs" company="alveus.dev">
|
|
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
|
|
// </copyright>
|
|
|
|
using Astral.Core.Entities;
|
|
using Astral.Core.Infrastructure;
|
|
using Astral.Core.RepositoryInterfaces;
|
|
using Dapper;
|
|
using Injectio.Attributes;
|
|
|
|
namespace Astral.DAL.Repositories;
|
|
|
|
/// <inheritdoc cref="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="IEmailDomainBlacklistRepository" />
|
|
public async Task<long> CountEntries()
|
|
{
|
|
return await WithDatabaseAsync(async connection =>
|
|
await connection.QueryFirstAsync<long>($"SELECT COUNT(*) FROM {Table};"));
|
|
}
|
|
}
|