- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试使用主键 CourseID 针对 odata web.api 使用以下命令查找单个记录:
var editedcourse = container.Courses.Where(c => c.CourseID == ID).SingleOrDefault();
<m:innererror>
<m:message>The 'ObjectContent`1' type failed to serialize the response body for content type 'application/atom+xml; charset=utf-8'.</m:message>
<m:type>System.InvalidOperationException</m:type>
<m:stacktrace></m:stacktrace>
<m:internalexception>
<m:message>'SingleResult`1' cannot be serialized using the ODataMediaTypeFormatter.</m:message>
<m:type>System.Runtime.Serialization.SerializationException</m:type>
最佳答案
默认情况下 web.api Controller 方法不可查询,因此客户端失败。添加注释以修复:[Queryable(AllowedOrderByProperties = "Id")]
关于odata - SingleResult<T> 无法在 Web API 中按键查询时序列化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22764589/
尝试使用主键 CourseID 针对 odata web.api 使用以下命令查找单个记录: var editedcourse = container.Courses.Where(c => c.Cou
如何在基于 ASP.NET 的服务器中查询 SingleResult 对象?请帮助编写以下代码。 public class UserController : TableController { ...
我尝试遵循文档 here和 here但没有运气。 我想从名为 moviesCollection 的 Collection 上的 FindOne 获取一个 singleResult 然后使用 Decod
我正在使用 OData v4 并试图让一个非常简单的 Controller 工作: Controller : public class ProductController : ODataControl
我不熟悉将 OData 与 Web Api 结合使用。我从数据库优先 EF 6 方法定义了我的模型,并添加了 OData Controller 。生成的代码在以下方面出错: _ Public
我是一名优秀的程序员,十分优秀!