Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing .Any() #50

Open
jezdimirovic opened this issue May 27, 2024 · 1 comment
Open

Missing .Any() #50

jezdimirovic opened this issue May 27, 2024 · 1 comment

Comments

@jezdimirovic
Copy link

Hello,

I was wondering, we do not have .Any() or I cannot find it?

Regards!

@dmitrii-kiselev
Copy link

Hi @jezdimirovic,

Please use these methods, this is what you need:

/// <summary>
/// This method checks whether the database table contains any record.
/// and returns <see cref="Task"/> of <see cref="bool"/>.
/// </summary>
/// <typeparam name="TEntity">The type of the entity.</typeparam>
/// <param name="cancellationToken"> A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
/// <returns>Returns <see cref="bool"/>.</returns>
Task<bool> ExistsAsync<TEntity>(CancellationToken cancellationToken = default)
   where TEntity : class;

/// <summary>
/// This method takes a predicate based on which existence of the entity will be determined
/// and returns <see cref="Task"/> of <see cref="bool"/>.
/// </summary>
/// <typeparam name="TEntity">The type of the entity.</typeparam>
/// <param name="condition">The condition based on which the existence will checked.</param>
/// <param name="cancellationToken"> A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
/// <returns>Returns <see cref="bool"/>.</returns>
Task<bool> ExistsAsync<TEntity>(Expression<Func<TEntity, bool>> condition, CancellationToken cancellationToken = default)
   where TEntity : class;

Best Regards,
Dmitrii Kiselev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants