コード例 #1
0
        /// <summary>
        ///     Asynchronously queries the database for copies of the values of the tracked entity as they currently exist in the database.
        ///     Note that changing the values in the returned dictionary will not update the values in the database.
        ///     If the entity is not found in the database then null is returned.
        /// </summary>
        /// <remarks>
        ///     Multiple active operations on the same context instance are not supported.  Use 'await' to ensure
        ///     that any asynchronous operations have completed before calling another method on this context.
        /// </remarks>
        /// <param name="cancellationToken">
        ///     A <see cref="CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        ///     A task that represents the asynchronous operation.
        ///     The task result contains the store values.
        /// </returns>
        public async Task <DbPropertyValues> GetDatabaseValuesAsync(CancellationToken cancellationToken)
        {
            var storeValues =
                await _internalEntityEntry.GetDatabaseValuesAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);

            return(storeValues == null ? null : new DbPropertyValues(storeValues));
        }
コード例 #2
0
        /// <summary>
        /// Asynchronously queries the database for copies of the values of the tracked entity as they currently exist in the database.
        /// Note that changing the values in the returned dictionary will not update the values in the database.
        /// If the entity is not found in the database then null is returned.
        /// </summary>
        /// <remarks>
        /// Multiple active operations on the same context instance are not supported.  Use 'await' to ensure
        /// that any asynchronous operations have completed before calling another method on this context.
        /// </remarks>
        /// <param name="cancellationToken">
        /// A <see cref="CancellationToken" /> to observe while waiting for the task to complete.
        /// </param>
        /// <returns>
        /// A task that represents the asynchronous operation.
        /// The task result contains the store values.
        /// </returns>
        public async Task <DbPropertyValues> GetDatabaseValuesAsync(CancellationToken cancellationToken)
        {
            var storeValues =
                await _internalEntityEntry.GetDatabaseValuesAsync(cancellationToken).WithCurrentCulture();

            return(storeValues == null ? null : new DbPropertyValues(storeValues));
        }