using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.AspNetCore.OData; using Microsoft.OData.Edm; using Microsoft.OData.ModelBuilder; namespace Indotalent.Infrastructure.OData; public static class DI { public static IServiceCollection AddODataService(this IServiceCollection services) { services.AddControllers().AddOData(options => { options.AddRouteComponents("odata", GetEdmModel()) .Select() .Filter() .OrderBy() .Expand() .Count() .SetMaxTop(GlobalConsts.ODataMaxTop); }); return services; } private static IEdmModel GetEdmModel() { var builder = new ODataConventionModelBuilder(); builder.EntitySet("SerilogLogs"); return builder.GetEdmModel(); } }