Share via


Metodo ObjectContext.RefreshAsync (RefreshMode, IEnumerable, CancellationToken)

[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]

Aggiorna in modo asincrono una raccolta di oggetti nel contesto dell'oggetto con i dati presenti nel database.

Spazio dei nomi:  System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

Sintassi

'Dichiarazione
Public Overridable Function RefreshAsync ( _
    refreshMode As RefreshMode, _
    collection As IEnumerable, _
    cancellationToken As CancellationToken _
) As Task
'Utilizzo
Dim instance As ObjectContext 
Dim refreshMode As RefreshMode 
Dim collection As IEnumerable 
Dim cancellationToken As CancellationToken 
Dim returnValue As Task 

returnValue = instance.RefreshAsync(refreshMode, _
    collection, cancellationToken)
public virtual Task RefreshAsync(
    RefreshMode refreshMode,
    IEnumerable collection,
    CancellationToken cancellationToken
)
public:
virtual Task^ RefreshAsync(
    RefreshMode refreshMode, 
    IEnumerable^ collection, 
    CancellationToken cancellationToken
)
abstract RefreshAsync : 
        refreshMode:RefreshMode * 
        collection:IEnumerable * 
        cancellationToken:CancellationToken -> Task  
override RefreshAsync : 
        refreshMode:RefreshMode * 
        collection:IEnumerable * 
        cancellationToken:CancellationToken -> Task
public function RefreshAsync(
    refreshMode : RefreshMode, 
    collection : IEnumerable, 
    cancellationToken : CancellationToken
) : Task

Parametri

Valore restituito

Tipo: System.Threading.Tasks.Task
Attività che rappresenta l'operazione asincrona.

Eccezioni

Eccezione Condizione
ArgumentNullException

collection è Null.

ArgumentOutOfRangeException

refreshMode non è valido.

ArgumentException

collection è vuoto o un oggetto non è collegato al contesto.

Note

Non è consentito eseguire più operazioni attive nella stessa istanza di contesto. Usare 'await' per assicurarsi che eventuali operazioni asincrone vengano completate prima di chiamare un altro metodo su questo contesto.

Vedere anche

Riferimento

ObjectContext Classe

Overload RefreshAsync

Spazio dei nomi System.Data.Entity.Core.Objects