PavelAndreyev1337_itransition-course-project/CollectionApp/CollectionApp.DAL/Extensions/QueryableExtension.cs
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Linq.Expressions;

namespace CollectionApp.DAL.Extensions
{
    public static class QueryableExtension
    {
        public static IQueryable<T> IncludeMultiple<T>(
            this IQueryable<T> query,
            params Expression<Func<T, object>>[] includes) where T : class
        {
            if (includes != null)
            {
                query = includes.Aggregate(
                    query,
                    (current, include) => current.Include(include));
            }
            return query;
        }
    }
}
