DataContext.Refresh Method

Definition

Refreshes object state by using data in the database.

Overloads

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.

Remarks

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.

Note

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)

Parameters

mode
RefreshMode

A value that specifies how optimistic concurrency conflicts are handled.

entities
IEnumerable

The collection of entities to be refreshed.

Applies to

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)

Parameters

mode
RefreshMode

A value that specifies how optimistic concurrency conflicts are handled.

entity
Object

The object to be refreshed.

Applies to

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())

Parameters

mode
RefreshMode

A value that specifies how optimistic concurrency conflicts are handled.

entities
Object[]

The array of entity objects to be refreshed.

Applies to