在 Raven DB 中查询 Json 文档 - 传递到 MVC 视图
下面是 Raven DB 中的 Json 文档。如何编写一个查询来获取该剧院中播放的所有电影并将其作为模型传递给 MVC 中的视图?感谢您的帮助。
{
"TheaterId": "Hd45",
"TheaterName" : "Blvd",
{
"MovieName": "Wild wild west",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Shrek",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Ronin",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
}
Below is a Json Document in Raven DB. How can I write a query that gets all movies playing in this theater and pass it on as a model to a view in MVC? Thanks for your help.
{
"TheaterId": "Hd45",
"TheaterName" : "Blvd",
{
"MovieName": "Wild wild west",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Shrek",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
{
"MovieName": "Ronin",
"ReleaseDate": "12th Dec",
"NumOfShows ": "5"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际的查询应该非常简单......
假设你有一个像这样的模型:
...那么 raven 查询可能看起来像这样:
但是 - 我想知道为什么你的 id 属性名为“TheaterId”而不是“Id”,这是默认的 RavenDB 约定。
也许您想查看 RacconBlog ,了解使用 RavenDB 精心设计的 MVC 应用程序的一个非常好的示例。
The actual query should be quite simple...
Assuming you have a model like this:
... then the raven query could look like that:
BUT - I'm wondering why you have your id-property named "TheaterId" instead of "Id", which is the default RavenDB-convention.
Probably you want to look at RacconBlog for a really good example of a well designed MVC-app with RavenDB.