File tree Expand file tree Collapse file tree
source/EasyWay.EntityFrameworkCore Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- namespace EasyWay
1+ using System . Linq . Expressions ;
2+
3+ namespace EasyWay
24{
35 public interface IWriteGenericRepository < TAggregateRoot >
46 where TAggregateRoot : AggregateRoot
@@ -12,5 +14,13 @@ public interface IWriteGenericRepository<TAggregateRoot>
1214 Task Remove ( TAggregateRoot aggregateRoot ) ;
1315
1416 Task Remove ( IEnumerable < TAggregateRoot > aggregateRoots ) ;
17+
18+ Task Any ( ) ;
19+
20+ Task Any ( Expression < Func < TAggregateRoot , bool > > predicate ) ;
21+
22+ Task < int > Count ( ) ;
23+
24+ Task < int > Count ( Expression < Func < TAggregateRoot , bool > > predicate ) ;
1525 }
1626}
Original file line number Diff line number Diff line change 11using Microsoft . EntityFrameworkCore ;
2+ using System . Linq . Expressions ;
23
34namespace EasyWay . Internals . Repositories
45{
@@ -22,6 +23,26 @@ public Task Add(IEnumerable<TAggregateRoot> aggregateRoots)
2223 return _aggregateRoots . AddRangeAsync ( aggregateRoots ) ;
2324 }
2425
26+ public Task Any ( )
27+ {
28+ return _aggregateRoots . AnyAsync ( ) ;
29+ }
30+
31+ public Task Any ( Expression < Func < TAggregateRoot , bool > > predicate )
32+ {
33+ return _aggregateRoots . AnyAsync ( predicate ) ;
34+ }
35+
36+ public Task < int > Count ( )
37+ {
38+ return _aggregateRoots . CountAsync ( ) ;
39+ }
40+
41+ public Task < int > Count ( Expression < Func < TAggregateRoot , bool > > predicate )
42+ {
43+ return _aggregateRoots . CountAsync ( predicate ) ;
44+ }
45+
2546 public Task < TAggregateRoot ? > Get ( Guid id )
2647 {
2748 return _aggregateRoots . FindAsync ( id ) . AsTask ( ) ;
You can’t perform that action at this time.
0 commit comments