首页 > 解决方案 > 如何在没有 EDM 的情况下在 .Net Core 上使用 Odata $batch

问题描述

有没有办法在不指定 EDM 模型的情况下使用 $batch

我正在使用7.4.1 Microsoft.AspNetCore.ODatanuget 包,它允许我使用 $batch

下面是我想避免的 GetEdmModel 示例,在此博客中进行了说明:

 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseODataBatching();
            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.Select().Filter().Expand().OrderBy();
                endpoints.MapODataRoute(
                    routeName: "api",
                    routePrefix: "api",
                    model: GetEdmModel(),
                    batchHandler: new DefaultODataBatchHandler());
            });
        }

标签: apiasp.net-core.net-coreodata

解决方案


推荐阅读