Class DatabaseConnectionCache
Represents a cache for DatabaseConnectionPair objects.
public class DatabaseConnectionCache : IPersistable
- Inheritance
-
DatabaseConnectionCache
- Implements
- Inherited Members
- Extension Methods
Constructors
DatabaseConnectionCache()
public DatabaseConnectionCache()
Properties
Connections
Gets all database connection pairs.
public IEnumerable<DatabaseConnectionPair> Connections { get; }
Property Value
Methods
DeleteConnection(DatabaseConnectionPair)
Deletes the specified database connection pair from the cache.
public bool DeleteConnection(DatabaseConnectionPair connection)
Parameters
connection
DatabaseConnectionPairThe database connection pair to delete.
Returns
- bool
True if the connection was successfully removed; otherwise, false.
GetOrAdd(string, string)
Retrieves an existing connection matching the specified provider and connection string or adds a new connection if it does not exist.
public DatabaseConnectionPair GetOrAdd(string provider, string connectionString)
Parameters
Returns
- DatabaseConnectionPair
The corresponding DatabaseConnectionPair.
Load(SettingsStorage)
Loads the database connection pairs from the specified settings storage.
public void Load(SettingsStorage storage)
Parameters
storage
SettingsStorageThe settings storage to load from.
Save(SettingsStorage)
Saves the database connection pairs to the specified settings storage.
public void Save(SettingsStorage storage)
Parameters
storage
SettingsStorageThe settings storage to save to.
Events
ConnectionCreated
Occurs when a new database connection pair is created.
public event Action<DatabaseConnectionPair> ConnectionCreated
Event Type
ConnectionDeleted
Occurs when a database connection pair is deleted.
public event Action<DatabaseConnectionPair> ConnectionDeleted
Event Type
Updated
Occurs when the connection cache is updated.
public event Action Updated