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

Parameters

mode
RefreshMode

A value that specifies how optimistic concurrency conflicts are handled.

entities
IEnumerable

The collection of entities to be refreshed.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Refresh(RefreshMode, Object)

Refreshes an entity object according to the specified mode.

public void Refresh (System.Data.Linq.RefreshMode mode, object entity);

Parameters

mode
RefreshMode

A value that specifies how optimistic concurrency conflicts are handled.

entity
Object

The object to be refreshed.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Refresh(RefreshMode, Object[])

Refreshes an array of entity objects according to the specified mode.

public void Refresh (System.Data.Linq.RefreshMode mode, params object[] entities);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1