LinkMenuExpand(external link)DocumentSearchCopyCopied

MySqlDataSourceBuilder.UsePeriodicPasswordProvider method

Configures a periodic password provider, which is automatically called by the data source at some regular interval. This is the recommended way to fetch a rotating access token.

public MySqlDataSourceBuilder UsePeriodicPasswordProvider(
    Func<MySqlProvidePasswordContext, CancellationToken, ValueTask<string>>? passwordProvider, 
    TimeSpan successRefreshInterval, TimeSpan failureRefreshInterval)
passwordProviderA callback which returns the password to be used by any new MySQL connections that are made.
successRefreshIntervalHow long to cache the password before re-invoking the callback.
failureRefreshIntervalHow long to wait before re-invoking the callback on failure. This should typically be much shorter than successRefreshInterval.

Return Value

This builder, so that method calls can be chained.

See Also