-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathService.cs
More file actions
25 lines (21 loc) · 773 Bytes
/
Service.cs
File metadata and controls
25 lines (21 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Microsoft.EntityFrameworkCore;
namespace BlazorApp
{
public class Service
{
private readonly IDbContextFactory<MyContext> _dbContextFactory;
public Service(IDbContextFactory<MyContext> dbContextFactory)
{
_dbContextFactory = dbContextFactory;
}
public async Task<IEnumerable<VirtualNumber>> GetResults(int count, int startIndex, CancellationToken cancellationToken)
{
using var dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.VirtualNumbers
.OrderBy(vn => vn.RowNumber)
.Skip(startIndex)
.Take(count)
.ToListAsync(cancellationToken);
}
}
}