mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-03-10 12:05:51 -04:00
Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com> Co-authored-by: Joe Milazzo <josephmajora@gmail.com>
26 lines
748 B
C#
26 lines
748 B
C#
using System.Linq;
|
|
using AutoMapper;
|
|
using AutoMapper.QueryableExtensions;
|
|
|
|
namespace Kavita.Database.Extensions;
|
|
|
|
public static class ProjectToExtensions
|
|
{
|
|
extension<TSource>(IQueryable<TSource> queryable)
|
|
{
|
|
public IQueryable<TDestination> ProjectToWithProgress<TDestination>(IConfigurationProvider config,
|
|
int userId)
|
|
{
|
|
return queryable.ProjectTo<TDestination>(config, new { userId });
|
|
}
|
|
|
|
// Convenience overload taking IMapper directly
|
|
public IQueryable<TDestination> ProjectToWithProgress<TDestination>(IMapper mapper,
|
|
int userId)
|
|
{
|
|
return queryable.ProjectTo<TDestination>(mapper.ConfigurationProvider, new { userId });
|
|
}
|
|
}
|
|
}
|
|
|