DataContext.Refresh 方法

定義

使用資料庫中的資料來重新整理物件狀態。Refreshes object state by using data in the database.

多載

Refresh(RefreshMode, IEnumerable)

根據指定的模式重新整理實體物件集合。Refreshes a collection of entity objects according to the specified mode.

Refresh(RefreshMode, Object)

根據指定的模式重新整理實體物件。Refreshes an entity object according to the specified mode.

Refresh(RefreshMode, Object[])

根據指定的模式重新整理實體物件的陣列。Refreshes an array of entity objects according to the specified mode.

備註

在開放式平行存取錯誤之後,這個方法很有用,可讓專案進入狀態以進行其他嘗試。This method is useful after an optimistic concurrency error to bring items into a state for another attempt. 它會更新物件上基本欄位和屬性的狀態。It updates the state of the primitive fields and properties on the objects.

注意

如果物件位於一對多關聯性的端,則會設定物件的外鍵,且關聯性另一端的物件指標會設定為新的值。If an object is on the many side of a one-to-many relationship, the foreign key on the object will be set and the object pointer for the other side of the relationship will be set to the new value.

Refresh(RefreshMode, IEnumerable)

根據指定的模式重新整理實體物件集合。Refreshes a collection of entity objects according to the specified mode.

public:
 void Refresh(System::Data::Linq::RefreshMode mode, System::Collections::IEnumerable ^ entities);
public void Refresh (System.Data.Linq.RefreshMode mode, System.Collections.IEnumerable entities);
member this.Refresh : System.Data.Linq.RefreshMode * System.Collections.IEnumerable -> unit
Public Sub Refresh (mode As RefreshMode, entities As IEnumerable)

參數

mode
RefreshMode

值,指定如何處理開放式並行存取 (Optimistic Concurrency) 衝突。A value that specifies how optimistic concurrency conflicts are handled.

entities
IEnumerable

要重新整理的實體集合。The collection of entities to be refreshed.

Refresh(RefreshMode, Object)

根據指定的模式重新整理實體物件。Refreshes an entity object according to the specified mode.

public:
 void Refresh(System::Data::Linq::RefreshMode mode, System::Object ^ entity);
public void Refresh (System.Data.Linq.RefreshMode mode, object entity);
member this.Refresh : System.Data.Linq.RefreshMode * obj -> unit
Public Sub Refresh (mode As RefreshMode, entity As Object)

參數

mode
RefreshMode

值,指定如何處理開放式並行存取 (Optimistic Concurrency) 衝突。A value that specifies how optimistic concurrency conflicts are handled.

entity
Object

要重新整理的物件。The object to be refreshed.

Refresh(RefreshMode, Object[])

根據指定的模式重新整理實體物件的陣列。Refreshes an array of entity objects according to the specified mode.

public:
 void Refresh(System::Data::Linq::RefreshMode mode, ... cli::array <System::Object ^> ^ entities);
public void Refresh (System.Data.Linq.RefreshMode mode, params object[] entities);
member this.Refresh : System.Data.Linq.RefreshMode * obj[] -> unit
Public Sub Refresh (mode As RefreshMode, ParamArray entities As Object())

參數

mode
RefreshMode

值,指定如何處理開放式並行存取 (Optimistic Concurrency) 衝突。A value that specifies how optimistic concurrency conflicts are handled.

entities
Object[]

要重新整理的實體物件陣列。The array of entity objects to be refreshed.

適用於