我的EF Core 6 ODATA端点是返回整个基础架构而不是模型吗?

发布于 2025-01-28 04:53:11 字数 1279 浏览 3 评论 0原文

我的EF核心应用程序正在返回我想象的是响应中的上下文信息而不是模型。使用扩展选项调用端点时。这是返回的结果:

{
"$id": "1",
"instance": null,
"container": {
  "$id": "2",
  "name": "SurveyQuestionValidations",
  "value": null,
  "next0": {
    "$id": "3",
    "name": "Id",
    "value": 1,
    "autoSelected": true
  },
  "autoSelected": false
},
"model": {
  "$id": "4",
  "schemaElements": [
    {
      "$id": "5",
      "declaredKey": [
        {
          "$id": "6",
          "defaultValueString": null,
          "propertyKind": 1,
          "type": {
            "isNullable": false,
            "definition": {
              "$id": "7",
              "name": "Int32",
              "namespace": "Edm",
              "typeKind": 1,
              "primitiveKind": 9,
              "schemaElementKind": 1,
              "fullName": "Edm.Int32"
            }
          },
          "declaringType": {
            "$ref": "5"
          },
          "name": "Id"
        }
      ],
      "schemaElementKind": 1,
      "namespace": "Data.Models",
      "name": "SurveyQuestion",
      "fullName": "Data.ModelsSurveyQuestion",
      "typeKind": 2,
      "hasStream": false,
      "isAbstract": false,
      "isOpen": false,
      "declaredProperties": [ ...etc   

仅在使用扩展时才会发生。查询真的很慢,但我相信它是相关的。

My EF Core application is returning what I imagine is context information in response instead of model. When calling the endpoint with expand option. This is the result returned:

{
"$id": "1",
"instance": null,
"container": {
  "$id": "2",
  "name": "SurveyQuestionValidations",
  "value": null,
  "next0": {
    "$id": "3",
    "name": "Id",
    "value": 1,
    "autoSelected": true
  },
  "autoSelected": false
},
"model": {
  "$id": "4",
  "schemaElements": [
    {
      "$id": "5",
      "declaredKey": [
        {
          "$id": "6",
          "defaultValueString": null,
          "propertyKind": 1,
          "type": {
            "isNullable": false,
            "definition": {
              "$id": "7",
              "name": "Int32",
              "namespace": "Edm",
              "typeKind": 1,
              "primitiveKind": 9,
              "schemaElementKind": 1,
              "fullName": "Edm.Int32"
            }
          },
          "declaringType": {
            "$ref": "5"
          },
          "name": "Id"
        }
      ],
      "schemaElementKind": 1,
      "namespace": "Data.Models",
      "name": "SurveyQuestion",
      "fullName": "Data.ModelsSurveyQuestion",
      "typeKind": 2,
      "hasStream": false,
      "isAbstract": false,
      "isOpen": false,
      "declaredProperties": [ ...etc   

This only happens when using expand. And the query is really slow but I believe it is related.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文