<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Platform;

namespace osu.Game.Database
{
    public abstract class MutableDatabaseBackedStoreWithFileIncludes<T, U> : MutableDatabaseBackedStore<T>
        where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles<U>
        where U : INamedFileInfo
    {
        protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null)
            : base(contextFactory, storage)
        {
        }

        protected override IQueryable<T> AddIncludesForConsumption(IQueryable<T> query) =>
            base.AddIncludesForConsumption(query)
                .Include(s => s.Files).ThenInclude(f => f.FileInfo);
    }
}<commit_msg>Ensure deletions are correct without relying on FK cascade rule<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Platform;

namespace osu.Game.Database
{
    public abstract class MutableDatabaseBackedStoreWithFileIncludes<T, U> : MutableDatabaseBackedStore<T>
        where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles<U>
        where U : INamedFileInfo
    {
        protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null)
            : base(contextFactory, storage)
        {
        }

        protected override IQueryable<T> AddIncludesForConsumption(IQueryable<T> query) =>
            base.AddIncludesForConsumption(query)
                .Include(s => s.Files).ThenInclude(f => f.FileInfo);

        protected override IQueryable<T> AddIncludesForDeletion(IQueryable<T> query) =>
            base.AddIncludesForDeletion(query)
                .Include(s => s.Files); // don't include FileInfo. these are handled by the FileStore itself.
    }
}
{'fraction_non_alphanumeric': 0.08293838862559241, 'fraction_numerical': 0.0, 'mean_word_length': 3.463002114164905, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2652229', 'n_tokens_mistral': 611, 'n_tokens_neox': 586, 'n_words': 155}