Skip to content

Commit 716c6cf

Browse files
committed
Add pagination method and update README.md
- Introduced `GetAllPagingAsync` method in `IYourEntityService` for flexible pagination options. - Updated `YourEntityService` to implement the new pagination method and simplified `GetPaginatedAsync`. - Added a "Contributing" section to `README.md` to encourage community contributions.
1 parent d722aa4 commit 716c6cf

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public interface IYourEntityService
6363

6464
//Optional method
6565
Task<PaginatedResult<TEntity>> GetPaginatedAsync(IQueryable<TEntity> query, int pageNumber, int pageSize);
66+
67+
//Optional method for pagination (Prefer this method instead of GetPaginatedAsync)
68+
Task<PaginatedResult<TEntity>> GetAllPagingAsync(int pageNumber, int pageSize, Func<IQueryable<TEntity>,
69+
IIncludableQueryable<TEntity, object>> includes = null!, Expression<Func<TEntity, bool>> filter = null!,
70+
Expression<Func<TEntity, object>> orderBy = null!, bool ascending = true);
6671
}
6772
```
6873

@@ -118,13 +123,25 @@ public class YourEntityService : IYourEntityService
118123
//Example: var query = await repository.GetAllAsync(); var result = await repository.GetPaginatedAsync(query, 1, 10);
119124
public async Task<PaginatedResult<TEntity>> GetPaginatedAsync(IQueryable<TEntity> query, int pageNumber, int pageSize)
120125
{
121-
var result = await repository.GetPaginatedAsync(query, pageNumber, pageSize);
126+
return await repository.GetPaginatedAsync(query, pageNumber, pageSize);
127+
}
122128

123-
return result;
129+
//Optional method for pagination (Prefer this method instead of GetPaginatedAsync)
130+
public async Task<PaginatedResult<TEntity>> GetAllPagingAsync(int pageNumber, int pageSize, Func<IQueryable<TEntity>,
131+
IIncludableQueryable<TEntity, object>> includes = null!, Expression<Func<TEntity, bool>> filter = null!,
132+
Expression<Func<TEntity, object>> orderBy = null!, bool ascending = true)
133+
{
134+
return await repository.await repository.GetAllPagingAsync(pageNumber: 2, pageSize: 5, includes: q => q.Include(p => p.Indirizzo), filter: w => w.Id <= 10);
124135
}
125136
}
126137
```
127138

139+
<!--
140+
## Test results
141+
142+
![Test Results](your_image_link_here)
143+
-->
144+
128145
## Contributing
129146

130147
Contributions and/or suggestions are always welcome.

0 commit comments

Comments
 (0)