Repository: dotnet/efcore
File: src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs (C#)

Code before:
                    method: IgnoreQueryFiltersMethodInfo.MakeGenericMethod(typeof(TEntity)),
                    arguments: source.Expression))
            : source;

    /// <summary>
    ///     Specifies that the current Entity Framework LINQ query should not have any model-level entity query filters applied.
    /// </summary>
    /// <remarks>
    ///     See <see href="https://aka.ms/efcore-docs-query-filters">EF Core query filters</see> for more information and examples.
    /// </remarks>
    /// <typeparam name="TEntity">The type of entity being queried.</typeparam>
    /// <param name="source">The source query.</param>
    /// <param name="filterKeys">The filter keys.</param>
    /// <returns>A new query that will not apply any model-level entity query filters.</returns>
    /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
    public static IQueryable<TEntity> IgnoreQueryFilters<TEntity>(
        this IQueryable<TEntity> source,
        [NotParameterized] IReadOnlyCollection<string> filterKeys)
        where TEntity : class
        => source.Provider is EntityQueryProvider
            ? source.Provider.CreateQuery<TEntity>(
                Expression.Call(
                    instance: null,
                    method: IgnoreNamedQueryFiltersMethodInfo.MakeGenericMethod(typeof(TEntity)),
                    // converting the collection to a sorted set to ensure cache is hit even when order of keys differs
                    arguments: [source.Expression, Expression.Constant(new SortedSet<string>(filterKeys))]))
            : source;

    #endregion

    #region Tracking

    internal static readonly MethodInfo AsNoTrackingMethodInfo
        = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(AsNoTracking))!;

    /// <summary>
    ///     The change tracker will not track any of the entities that are returned from a LINQ query. If the
    ///     entity instances are modified, this will not be detected by the change tracker and
    ///     <see cref="DbContext.SaveChanges()" /> will not persist those changes to the database.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting
    ///         up change tracking for each entity instance. You should not disable change tracking if you want to
    ///         manipulate entity instances and persist those changes to the database using
    ///         <see cref="DbContext.SaveChanges()" />.
    ///     </para>
    ///     <para>
    ///         Identity resolution will not be performed. If an entity with a given key is in different result in the result set
    ///         then they will be different instances.
    ///     </para>

Review comment (suggestion):
This is a nice approach. But for 10 servicing we want to keep the changes to a minimum to prevent any unforeseen problems. Change this to an array (and check whether it is not already an array to prevent double work) here and that should be it.

Code after:
                    method: IgnoreQueryFiltersMethodInfo.MakeGenericMethod(typeof(TEntity)),
                    arguments: source.Expression))
            : source;

    /// <summary>
    ///     Specifies that the current Entity Framework LINQ query should not have any model-level entity query filters applied.
    /// </summary>
    /// <remarks>
    ///     See <see href="https://aka.ms/efcore-docs-query-filters">EF Core query filters</see> for more information and examples.
    /// </remarks>
    /// <typeparam name="TEntity">The type of entity being queried.</typeparam>
    /// <param name="source">The source query.</param>
    /// <param name="filterKeys">The filter keys.</param>
    /// <returns>A new query that will not apply any model-level entity query filters.</returns>
    /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
    public static IQueryable<TEntity> IgnoreQueryFilters<TEntity>(
        this IQueryable<TEntity> source,
        [NotParameterized] IReadOnlyCollection<string> filterKeys)
        where TEntity : class
        => source.Provider is EntityQueryProvider
            ? source.Provider.CreateQuery<TEntity>(
                Expression.Call(
                    instance: null,
                    method: IgnoreNamedQueryFiltersMethodInfo.MakeGenericMethod(typeof(TEntity)),
                    // converting the collection to an array if it isn't already one to ensure consistent caching. Fixes #37112.
                    // #37212 may be a possible future solution providing broader capabilities around parameterizing collections.
                    arguments: [source.Expression, Expression.Constant(filterKeys is string[] ? filterKeys : filterKeys.ToArray())]))
            : source;

    #endregion

    #region Tracking

    internal static readonly MethodInfo AsNoTrackingMethodInfo
        = typeof(EntityFrameworkQueryableExtensions).GetTypeInfo().GetDeclaredMethod(nameof(AsNoTracking))!;

    /// <summary>
    ///     The change tracker will not track any of the entities that are returned from a LINQ query. If the
    ///     entity instances are modified, this will not be detected by the change tracker and
    ///     <see cref="DbContext.SaveChanges()" /> will not persist those changes to the database.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting
    ///         up change tracking for each entity instance. You should not disable change tracking if you want to
    ///         manipulate entity instances and persist those changes to the database using
    ///         <see cref="DbContext.SaveChanges()" />.
    ///     </para>
    ///     <para>
    ///         Identity resolution will not be performed. If an entity with a given key is in different result in the result set
    ///         then they will be different instances.