DatabaseConnectionCache
Represents a cache for DatabaseConnectionPair objects.
Implementa: IAsyncPersistable
Propiedades
public IEnumerable<DatabaseConnectionPair> Connections { get; }
value = databaseConnectionCache.Connections
Gets all database connection pairs.
Métodos
public bool DeleteConnection(DatabaseConnectionPair connection)
result = databaseConnectionCache.DeleteConnection(connection)
Deletes the specified database connection pair from the cache.
- connection
- The database connection pair to delete.
Devuelve: True if the connection was successfully removed; otherwise, false.
public DatabaseConnectionPair GetOrAdd(string provider, string connectionString)
result = databaseConnectionCache.GetOrAdd(provider, connectionString)
Retrieves an existing connection matching the specified provider and connection string or adds a new connection if it does not exist.
- provider
- The database provider.
- connectionString
- The connection string.
Devuelve: The corresponding DatabaseConnectionPair.
public Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = databaseConnectionCache.LoadAsync(storage, cancellationToken)
Loads the database connection pairs from the specified settings storage.
- storage
- The settings storage to load from.
- cancellationToken
- CancellationToken
Devuelve: Task
public Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = databaseConnectionCache.SaveAsync(storage, cancellationToken)
Saves the database connection pairs to the specified settings storage.
- storage
- The settings storage to save to.
- cancellationToken
- CancellationToken
Devuelve: Task
Eventos
public event Action<DatabaseConnectionPair> ConnectionCreated
databaseConnectionCache.ConnectionCreated += handler
Occurs when a new database connection pair is created.
public event Action<DatabaseConnectionPair> ConnectionDeleted
databaseConnectionCache.ConnectionDeleted += handler
Occurs when a database connection pair is deleted.
public event Action Updated
databaseConnectionCache.Updated += handler
Occurs when the connection cache is updated.