RavenDB 附带的示例数据库具有Albums文档集合,每个集合中都有一个Genre嵌入文档,如下所示:
{
... other stuff...
"Genre": {
"Id": "genres/1",
"Name": "Rock"
},
... other stuff...
}
请注意,这里有GenrehasId和Namefields。
但是当您查看Genre文档时,它们具有Id、Name和Description字段,如下所示:
{
"Description": "Rock and Roll is a form of rock music developed in the 1950s and 1960s. Rock music combines many kinds of music from the United States, such as country music, folk music, church music, work songs, blues and jazz.",
"Name": "Rock"
}
我如何在代码中建模,以便当我保存自己的文档与保存文档并嵌入Store()时SaveChanges(),序列化和保存的方式不同(如示例数据) ?GenreAlbumGenre