我将RavenDb用于门户网站。以下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
}
在重构后,Question类的命名空间发生了变化。在文档元数据中(在乌鸦中)检测到更改并且没关系。但是嵌套集合如:
"Supporters": {
"$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
"$values": []
},
? 当我试图从应用程序级别获取它时,那段文档会生成错误。当我将其更改为:
时问题消失 "Supporters": [],
但如果我必须对200个文件执行该操作,则不是解决方案。
有没有办法自动完成?