Skip to content

Commit

Permalink
Adding AnyAsync to IQuery.
Browse files Browse the repository at this point in the history
  • Loading branch information
lelong37 committed Feb 18, 2018
1 parent 2f244f4 commit 1d9ab89
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions URF.Core.Abstractions/IQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public interface IQuery<TEntity> where TEntity : class
Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
Task<IEnumerable<TEntity>> SelectSqlAsync(string sql, object[] parameters, CancellationToken cancellationToken = default);
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
Task<bool> AnyAsync(CancellationToken cancellationToken);
}
}
7 changes: 5 additions & 2 deletions URF.Core.Abstractions/IRepository.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using System.Collections.Generic;
#region

using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using URF.Core.Abstractions;

#endregion

namespace Urf.Core.Abstractions
{
public interface IRepository<TEntity> where TEntity : class
Expand Down
5 changes: 4 additions & 1 deletion URF.Core.EF/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ public virtual async Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity,
public virtual async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken)
=> await _query.AnyAsync(predicate, cancellationToken);

public virtual async Task<bool> AnyAsync(CancellationToken cancellationToken)
=> await _query.AnyAsync(cancellationToken);

public virtual async Task<bool> AllAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken)
=> await _query.AllAsync(predicate, cancellationToken);

public virtual async Task<IEnumerable<TEntity>> SelectSqlAsync(string sql, object[] parameters, CancellationToken cancellationToken = default)
=> await _query.FromSql(sql, (object[])parameters).ToListAsync(cancellationToken);
=> await _query.FromSql(sql, parameters).ToListAsync(cancellationToken);

private IQuery<TEntity> Set(Action<Query<TEntity>> setParameter)
{
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# URF.Core #
* **_<sup>Unit-of-Work & Repository Framework | Official [URF](https://github.com/urfnet) & [Trackable](https://github.com/TrackableEntities) Team</sup>_**
**_<sup>Unit-of-Work & Repository Framework | Official [URF](https://github.com/urfnet) & [Trackable](https://github.com/TrackableEntities) Team</sup>_**

[![Build Status](https://travis-ci.org/urfnet/URF.Core.svg?branch=master)](https://travis-ci.org/urfnet/URF.Core)
##### Docs: [comming soon](https://goo.gl/6zh9zp) | Subscribe URF Updates: [@lelong37](http://twitter.com/lelong37) | NuGet: [goo.gl/WEn7Jm](https://goo.gl/WEn7Jm) | Samples: [https://goo.gl/MgC4tG](https://goo.gl/MgC4tG) ####
Expand Down Expand Up @@ -130,7 +130,7 @@ public class ProductsController : ODataController
URF.Core has been completly re-written, and everything is now completely `task`, `async`, `await` right out of the box. This way, team's will automatically get the best thread management and utilize and max out on asyncronous perf improvements.

#### URF Powered & Sponsered by:
<table border="0">
<table border="0" style="border:0px;none">
<tr>
<td>
<img src="https://user-images.githubusercontent.com/4691404/36338938-0a7b6f7e-1380-11e8-94d1-6c308989aa6c.png" width="500px">
Expand Down

0 comments on commit 1d9ab89

Please sign in to comment.