【问题标题】:OData using $select with asp.net core throws System.ArgumentException使用 $select 和 asp.net 核心的 OData 抛出 System.ArgumentException
【发布时间】:2021-03-22 15:33:40
【问题描述】:

查询$filter=DatetimeLocal gt 2021-03-19T12:50:54.219Z&$select=OrganizationId

错误:System.ArgumentException:序列化程序的值类型是 Microsoft.AspNet.OData.Query.Expressions.PropertyContainer+NamedProperty`1[[System.String, System.Private.CoreLib, Version= 4.0.0.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e]] 并且与成员类型 Microsoft.AspNet.OData.Query.Expressions.PropertyContainer 不匹配。 (参数‘序列化器’)

我使用本教程来实现 OData:https://docs.microsoft.com/en-us/odata/webapi/first-odata-api

可能是什么问题?

【问题讨论】:

    标签: c# mongodb asp.net-core odata


    【解决方案1】:

    查询应该是这种格式?$filter=CreatedDate gt 2021-03-22T10:39:35Z

    【讨论】:

    • 选择呢?我需要选择,这就是问题
    • ?$filter=CreatedDate gt 2021-03-22T10:39:35Z&$select=PropA 正在为我工​​作。问题是您这边缺少一些 dll。 @GeraldHughes
    • 你使用什么版本?请问你是怎么配置odata的?
    猜你喜欢
    • 1970-01-01
    • 2012-10-16
    • 2020-09-23
    • 2021-11-17
    • 2021-04-30
    • 2019-01-29
    • 1970-01-01
    • 2019-04-04
    • 1970-01-01
    相关资源
    最近更新 更多