mirror of https://github.com/abpframework/abp.git
5 changed files with 19 additions and 53 deletions
@ -1,13 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace ProductManagement |
|||
{ |
|||
public interface IProductRepository : IBasicRepository<Product, Guid> |
|||
{ |
|||
Task<List<Product>> GetListAsync(string sorting, int maxResultCount, int skipCount); |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using ProductManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using System.Linq; |
|||
using System.Linq.Dynamic.Core; |
|||
using Microsoft.EntityFrameworkCore; |
|||
|
|||
namespace ProductManagement |
|||
{ |
|||
public class EfCoreProductRepository : EfCoreRepository<IProductManagementDbContext, Product, Guid>, IProductRepository |
|||
{ |
|||
public EfCoreProductRepository(IDbContextProvider<IProductManagementDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<List<Product>> GetListAsync(string sorting, int maxResultCount, int skipCount) |
|||
{ |
|||
// TODO: refactor sorting
|
|||
var products = await DbSet.OrderBy(sorting ?? "creationTime desc") |
|||
.PageBy(skipCount, maxResultCount) |
|||
.ToListAsync(); |
|||
|
|||
return products; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue