Added database loading logic

This commit is contained in:
2025-01-14 14:05:15 +01:00
parent 313f6e046a
commit 6115dcf8e1
13 changed files with 139 additions and 35 deletions

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
namespace HopFrame.Core.Services.Implementations;
internal sealed class TableManager<TModel>(DbContext context) : ITableManager where TModel : class {
public async Task<IEnumerable<object>> LoadPage(int page, int perPage = 25) {
var table = context.Set<TModel>();
return await table
.Skip(page * perPage)
.Take(perPage)
.ToArrayAsync();
}
}