neolei
neolei

Reputation: 1948

What ObjectContext.SaveChanges() do under the hood?

Is ObjectContext.SaveChanges() calls ObjectContext.SaveChanges(SaveOptions.AcceptAllChangesAfterSave | SaveOptions.DetectChangesBeforeSave) under the hood?

Just want to be sure so that I can use SaveChanges() to replace all SaveChanges(SaveOptions.AcceptAllChangesAfterSave | SaveOptions.DetectChangesBeforeSave)

Thanks.

Upvotes: 0

Views: 920

Answers (1)

StriplingWarrior
StriplingWarrior

Reputation: 156459

Yes, it does exactly that.

From 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);
}

Upvotes: 4

Related Questions