Ejemplo n.º 1
0
        /// <summary>
        /// Returns a list of all usable <see cref="BeatmapSetInfo"/>s. Note that files are not populated.
        /// </summary>
        /// <param name="includes">The level of detail to include in the returned objects.</param>
        /// <param name="includeProtected">Whether to include protected (system) beatmaps. These should not be included for gameplay playable use cases.</param>
        /// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
        public IEnumerable <BeatmapSetInfo> GetAllUsableBeatmapSetsEnumerable(IncludedDetails includes, bool includeProtected = false)
        {
            IQueryable <BeatmapSetInfo> queryable;

            switch (includes)
            {
            case IncludedDetails.Minimal:
                queryable = beatmaps.BeatmapSetsOverview;
                break;

            case IncludedDetails.AllButRuleset:
                queryable = beatmaps.BeatmapSetsWithoutRuleset;
                break;

            case IncludedDetails.AllButFiles:
                queryable = beatmaps.BeatmapSetsWithoutFiles;
                break;

            default:
                queryable = beatmaps.ConsumableItems;
                break;
            }

            // AsEnumerable used here to avoid applying the WHERE in sql. When done so, ef core 2.x uses an incorrect ORDER BY
            // clause which causes queries to take 5-10x longer.
            // TODO: remove if upgrading to EF core 3.x.
            return(queryable.AsEnumerable().Where(s => !s.DeletePending && (includeProtected || !s.Protected)));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
 /// </summary>
 /// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
 public List <BeatmapSetInfo> GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All) => GetAllUsableBeatmapSetsEnumerable(includes).ToList();
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
 /// </summary>
 /// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
 public List <BeatmapSetInfo> GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All, bool includeProtected = false) =>
 GetAllUsableBeatmapSetsEnumerable(includes, includeProtected).ToList();
Ejemplo n.º 4
0
        /// <summary>
        /// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <param name="includes">The level of detail to include in the returned objects.</param>
        /// <returns>Results from the provided query.</returns>
        public IEnumerable <BeatmapSetInfo> QueryBeatmapSets(Expression <Func <BeatmapSetInfo, bool> > query, IncludedDetails includes = IncludedDetails.All)
        {
            IQueryable <BeatmapSetInfo> queryable;

            switch (includes)
            {
            case IncludedDetails.Minimal:
                queryable = beatmaps.BeatmapSetsOverview;
                break;

            case IncludedDetails.AllButRuleset:
                queryable = beatmaps.BeatmapSetsWithoutRuleset;
                break;

            case IncludedDetails.AllButFiles:
                queryable = beatmaps.BeatmapSetsWithoutFiles;
                break;

            default:
                queryable = beatmaps.ConsumableItems;
                break;
            }

            return(queryable.AsNoTracking().Where(query));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="includes">The level of detail to include in the returned objects.</param>
 /// <returns>Results from the provided query.</returns>
 public IEnumerable <BeatmapSetInfo> QueryBeatmapSets(Expression <Func <BeatmapSetInfo, bool> > query, IncludedDetails includes = IncludedDetails.All) => beatmapModelManager.QueryBeatmapSets(query, includes);
Ejemplo n.º 6
0
 /// <summary>
 /// Returns a list of all usable <see cref="BeatmapSetInfo"/>s. Note that files are not populated.
 /// </summary>
 /// <param name="includes">The level of detail to include in the returned objects.</param>
 /// <param name="includeProtected">Whether to include protected (system) beatmaps. These should not be included for gameplay playable use cases.</param>
 /// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
 public IEnumerable <BeatmapSetInfo> GetAllUsableBeatmapSetsEnumerable(IncludedDetails includes, bool includeProtected = false) => beatmapModelManager.GetAllUsableBeatmapSetsEnumerable(includes, includeProtected);
Ejemplo n.º 7
0
 /// <summary>
 /// Returns a list of all usable <see cref="BeatmapSetInfo"/>s.
 /// </summary>
 /// <returns>A list of available <see cref="BeatmapSetInfo"/>.</returns>
 public List <BeatmapSetInfo> GetAllUsableBeatmapSets(IncludedDetails includes = IncludedDetails.All, bool includeProtected = false) => beatmapModelManager.GetAllUsableBeatmapSets(includes, includeProtected);