2011-10-27 59 views
0

ObjectContext.SaveChanges()在引擎蓋下調用ObjectContext.SaveChanges(SaveOptions.AcceptAllChangesAfterSave | SaveOptions.DetectChangesBeforeSave)嗎?ObjectContext.SaveChanges()在底層做了什麼?

只是想確保,這樣我可以使用的SaveChanges(),以取代所有的SaveChanges(SaveOptions.AcceptAllChangesAfterSave | SaveOptions.DetectChangesBeforeSave)

感謝。

回答

4

是的,它確實如此。

從ILSpy:

// System.Data.Objects.ObjectContext 
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] 
public int SaveChanges() 
{ 
    return this.SaveChanges(SaveOptions.AcceptAllChangesAfterSave | SaveOptions.DetectChangesBeforeSave); 
} 
+0

+1,感謝向我介紹了ILSpy。我一直在使用Reflector試用版。我更喜歡Reflector的用戶界面,但*免費*對我更好:) –

+0

@adrift:Resharper團隊還生成了一個名爲dotPeek的免費反編譯器。上次我嘗試了它,它似乎不如ILSpy那麼敏感,但我想它會隨着時間的推移而改進。 http://www.jetbrains.com/decompiler/ – StriplingWarrior

+0

非常好,謝謝! –