<commit_before>using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
using PurdueIo.Database.Models;

namespace PurdueIo.Api
{
    public static class EdmModelBuilder
    {
        public const int MAX_EXPAND_DEPTH = 5;

        private const int MAX_RESULTS = 10000;

        public static IEdmModel GetEdmModel()
        {
            var builder = new ODataConventionModelBuilder();

            builder.GenerateEntitySet<Campus>("Campus");
            builder.GenerateEntitySet<Building>("Building");
            builder.GenerateEntitySet<Room>("Room");
            builder.GenerateEntitySet<Term>("Term");
            builder.GenerateEntitySet<Course>("Course");
            builder.GenerateEntitySet<Class>("Class");
            builder.GenerateEntitySet<Section>("Section");
            builder.GenerateEntitySet<Meeting>("Meeting");
            builder.GenerateEntitySet<Subject>("Subject");
            builder.GenerateEntitySet<Instructor>("Instructor");

            return builder.GetEdmModel();
        }


        private static StructuralTypeConfiguration<T> GenerateEntitySet<T>(
            this ODataConventionModelBuilder builder, string name) where T : class
        {
            return builder.EntitySet<T>(name).EntityType
                .Filter()
                .Count()
                .Expand(MAX_EXPAND_DEPTH)
                .OrderBy()
                .Page(MAX_RESULTS, MAX_RESULTS)
                .Select();
        }
    }
}<commit_msg>📄 Remove page limit due to EF Core query generation bug (#43)<commit_after>using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
using PurdueIo.Database.Models;

namespace PurdueIo.Api
{
    public static class EdmModelBuilder
    {
        public const int MAX_EXPAND_DEPTH = 5;

        private const int MAX_RESULTS = 10000;

        public static IEdmModel GetEdmModel()
        {
            var builder = new ODataConventionModelBuilder();

            builder.GenerateEntitySet<Campus>("Campus");
            builder.GenerateEntitySet<Building>("Building");
            builder.GenerateEntitySet<Room>("Room");
            builder.GenerateEntitySet<Term>("Term");
            builder.GenerateEntitySet<Course>("Course");
            builder.GenerateEntitySet<Class>("Class");
            builder.GenerateEntitySet<Section>("Section");
            builder.GenerateEntitySet<Meeting>("Meeting");
            builder.GenerateEntitySet<Subject>("Subject");
            builder.GenerateEntitySet<Instructor>("Instructor");

            return builder.GetEdmModel();
        }


        private static StructuralTypeConfiguration<T> GenerateEntitySet<T>(
            this ODataConventionModelBuilder builder, string name) where T : class
        {
            return builder.EntitySet<T>(name).EntityType
                .Filter()
                .Count()
                .Expand(MAX_EXPAND_DEPTH)
                .OrderBy()
                // .Page(MAX_RESULTS, MAX_RESULTS) // Pending query gen fix available in .NET 6
                                                   // https://github.com/dotnet/efcore/issues/24726
                .Select();
        }
    }
}
{'fraction_non_alphanumeric': 0.10050729232720355, 'fraction_numerical': 0.0063411540900443885, 'mean_word_length': 2.209562563580875, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7119492', 'n_tokens_mistral': 834, 'n_tokens_neox': 785, 'n_words': 146}