コード例 #1
0
ファイル: BeatmapModelManager.cs プロジェクト: Game4all/osu
        /// <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)));
        }
コード例 #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();
コード例 #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();
コード例 #4
0
ファイル: BeatmapModelManager.cs プロジェクト: Game4all/osu
        /// <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));
        }
コード例 #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);
コード例 #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);
コード例 #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);