我正在尝试使用Patch API更新嵌套集合.更具体地说,请考虑以下示例 - Posts集合:
{
"Title": "Hello RavenDB",
"Category": "RavenDB",
"Content": "This is a blog about RavenDB",
"Comments": [
{
"Title": "Unrealistic",
"Content": "This example is unrealistic"
},
{
"Title": "Nice",
"Content": "This example is nice"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我在http://ravendb.net/docs/client-api/partial-document-updates和http://ravendb.net/docs/client-api/set-based-使用了Patch API和基于集合的操作文档.操作以及几个stackoverflow问题作为使用set操作和静态索引进行批量更新的资源.要求是仅在前一个值为"Nice"时更新注释的"Title",如果是,则将其更新为"Bad".
静态索引"NicePosts"定义为:
Map = posts => from post in posts
where post.Comments.Any(comment => comment.Title == "Nice")
select new {post.Title, post.Category}
Run Code Online (Sandbox Code Playgroud)
批量修补程序更新命令是:
documentStore.DatabaseCommands.UpdateByIndex("NicePosts",
new IndexQuery(),
new[] { new PatchRequest
{ Type = PatchCommandType.Modify,
Name = …Run Code Online (Sandbox Code Playgroud) MVC相对于webforms的两个最大优点是不存在的viewstate和URL路由.VS2010和.NET 4.0包含用于Webforms的内置URL路由以及更好地控制viewstate.
由于MVC设计模式及其一般的轻量级特性,我主张将MVC用于外联网站点,但鉴于这一新的公告,Webforms缩小了差距?为什么你仍然会选择MVC而不是Webforms?
谢谢