api - 如何在没有 EDM 的情况下在 .Net Core 上使用 Odata $batch
问题描述
有没有办法在不指定 EDM 模型的情况下使用 $batch
我正在使用7.4.1 Microsoft.AspNetCore.OData
nuget 包,它允许我使用 $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());
});
}
解决方案
推荐阅读
- javascript - 为什么猫鼬不查询?
- sqlexception - Grails 3.3.3 战争部署在 Tomcat 8.5 上,关闭 jdbc 连接问题
- vba - 序号
- r - 使用 dplyr 计算不同时间条件值之间的绝对差
- objective-c - 如何在 localNotification 上安排随机消息
- google-bigquery - 在 BigQuery 中创建或更新架构时出现问题
- ruby - 为外部 api Ruby on Rails 生成安全令牌
- aframe - 有没有一种简单的方法来获取 a-frame 声音的持续时间?
- video - 如何在不影响视频数据的情况下使用 ffmpeg 写入 mp4 元数据
- java - Java 的 CipherOutputStream 与 Apache 的 CryptoOutputStream 性能