共用方式為


ObjectContext.SaveChanges 方法 (Boolean)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

注意:這個 API 現在已經過時。

命名空間:  System.Data.Entity.Core.Objects
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")> _
<BrowsableAttribute(False)> _
<EditorBrowsableAttribute(EditorBrowsableState.Never)> _
Public Overridable Function SaveChanges ( _
    acceptChangesDuringSave As Boolean _
) As Integer
'用途
Dim instance As ObjectContext 
Dim acceptChangesDuringSave As Boolean 
Dim returnValue As Integer 

returnValue = instance.SaveChanges(acceptChangesDuringSave)
[ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")]
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
public virtual int SaveChanges(
    bool acceptChangesDuringSave
)
[ObsoleteAttribute(L"Use SaveChanges(SaveOptions options) instead.")]
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState::Never)]
public:
virtual int SaveChanges(
    bool acceptChangesDuringSave
)
[<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")>]
[<BrowsableAttribute(false)>]
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
abstract SaveChanges : 
        acceptChangesDuringSave:bool -> int 
[<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")>]
[<BrowsableAttribute(false)>]
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
override SaveChanges : 
        acceptChangesDuringSave:bool -> int
public function SaveChanges(
    acceptChangesDuringSave : boolean
) : int

參數

  • acceptChangesDuringSave
    類型:System.Boolean
    用戶端交易支援需要此參數。 如果為 true,就會在 SaveChanges(Boolean) 完成之後,重設所有物件的變更追蹤。 如果為 false,您就必須在 SaveChanges(Boolean) 之後呼叫 AcceptAllChanges() 方法。

傳回值

類型:System.Int32
呼叫 SaveChanges() 時處於 AddedModifiedDeleted 狀態中的物件數目。

例外狀況

例外狀況 條件
OptimisticConcurrencyException

儲存變更期間發生開放式並行存取違規。

請參閱

參考

ObjectContext 類別

SaveChanges 多載

System.Data.Entity.Core.Objects 命名空間