Lingua

EntityEntry.GetDatabaseValuesAsync(CancellationToken) Metodo

Definizione

Esegue una query sul database per verificare la presenza di copie dei valori dell'entità rilevata nel database. Se l'entità non viene trovata nel database, viene restituito null.

public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.ChangeTracking.PropertyValues> GetDatabaseValuesAsync(System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.ChangeTracking.PropertyValues?> GetDatabaseValuesAsync(System.Threading.CancellationToken cancellationToken = default);
abstract member GetDatabaseValuesAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.ChangeTracking.PropertyValues>
override this.GetDatabaseValuesAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.ChangeTracking.PropertyValues>
Public Overridable Function GetDatabaseValuesAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of PropertyValues)

Parametri

cancellationToken
CancellationToken

Oggetto CancellationToken da osservare durante l'attesa del completamento dell'attività.

Valori restituiti

Attività che rappresenta l'operazione asincrona. Il risultato dell'attività contiene i valori dell'archivio o null se l'entità non esiste nel database.

Eccezioni

Se l'oggetto CancellationToken viene annullato.

Commenti

Si noti che la modifica dei valori nel dizionario restituito non aggiornerà i valori nel database.

Non sono supportate più operazioni attive nella stessa istanza di contesto. Usare await per assicurarsi che tutte le operazioni asincrone siano state completate prima di chiamare un altro metodo in questo contesto.

Per altre informazioni ed esempi, vedere Accesso alle entità rilevate in EF Core .

Si applica a