简体   繁体   English

嵌套集合 - 当实体名称空间已更改时发出问题

[英]Nested collections - issue,when namespace of entity has been changed

I use RavenDb for my portal. 我使用RavenDb作为我的门户网站。 Example of Question document below: Question文件示例如下:

{
  "CreatedOn": "2012-07-12T09:40:44.7514005Z",
  "CreatedBy": {
    "DisplayName": "Kamil",
  },
  "Subject": "My q",
  "Content": "My q content",
  "Tags": [
    "myQ"
  ],
  "Answers": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.Answer, QA.Core]], mscorlib",
    "$values": [
      {
        "CreatedOn": "2012-07-12T09:42:06.9852492Z",
        "CreatedBy": {
          "DisplayName": "Kamil",
        },
        "ModifiedOn": "2012-07-12T09:43:07.8442347Z",
        "ModifiedBy": {
          "DisplayName": "Kamil",
        },
        "Content": "My answer.",
        "IdNumber": 1,
        "Supporters": {
          "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
          "$values": []
        },
        "IsOfficial": true,
        "AttachmentHeaders": []
      }
    ]
  },
  "NumberOfViews": 3,
  "Supporters": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
    "$values": []
  },
  "NotificationEmails": [],
  "AttachmentHeaders": [],
  "LastAnswerId": 1
}

After big refactoring namespace of Question class has changed. 在重构后,Question类的命名空间发生了变化。 In document metadata (in raven) that change was detected and it's ok. 在文档元数据中(在乌鸦中)检测到更改并且没关系。 But what about nested collections like: 但是嵌套集合如下:

  "Supporters": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
    "$values": []
  },

? That piece of document generates error when i'm trying to get it from app level. 当我试图从应用程序级别获取它时,那段文档会生成错误。 Problem disappears when i change it to: 当我将其更改为时问题消失:

  "Supporters": [],

but it's not a solution if i have to do that action on 200 documents. 但如果我必须在200个文件上执行该操作,则不是解决方案。

Is any way to do that automatically? 有没有办法自动完成?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM