mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-06 06:45:18 -04:00
OPDS Performance Enhancements (#4332)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
|
||||
namespace API.Extensions.QueryExtensions;
|
||||
|
||||
public static class ProjectToExtensions
|
||||
{
|
||||
public static IQueryable<TDestination> ProjectToWithProgress<TSource, TDestination>(
|
||||
this IQueryable<TSource> queryable,
|
||||
IConfigurationProvider config,
|
||||
int userId)
|
||||
{
|
||||
return queryable.ProjectTo<TDestination>(config, new { userId });
|
||||
}
|
||||
|
||||
// Convenience overload taking IMapper directly
|
||||
public static IQueryable<TDestination> ProjectToWithProgress<TSource, TDestination>(
|
||||
this IQueryable<TSource> queryable,
|
||||
IMapper mapper,
|
||||
int userId)
|
||||
{
|
||||
return queryable.ProjectTo<TDestination>(mapper.ConfigurationProvider, new { userId });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user