C# 更改ParserEnabled的值后是否应调用SPWeb.Update

C# 更改ParserEnabled的值后是否应调用SPWeb.Update,c#,sharepoint,sharepoint-2007,C#,Sharepoint,Sharepoint 2007,如果我有以下代码: var web = SPContext.Current.Web; web.ParserEnabled = false; // !!! is web.Update() required here? // ... // add a document or otherwise change things // ... web.ParserEnabled = true; 我必须显式调用Update方法来提交对ParserEnabled属性的更改,还是在运行时由关心它的方法检查它?当

如果我有以下代码:

var web = SPContext.Current.Web;
web.ParserEnabled = false;
// !!! is web.Update() required here?
// ...
// add a document or otherwise change things
// ...
web.ParserEnabled = true;

我必须显式调用Update方法来提交对ParserEnabled属性的更改,还是在运行时由关心它的方法检查它?

当您更改未持久化到数据库的其他属性时,您不必调用
.Update()
.AllowUnsafeUpdates
),所以我认为你不需要在这里这么做


如果遇到问题,可以尝试将调用添加到代码中。

我今天早上运行了一些测试,更改ParserEnabled的值不会在请求之间持久化(或者实际上是SPSite/SPWeb的实例化),除非我在设置后调用.Update()。如果我调用Update方法,它会像预期的那样保持不变。