DefaultConnectionStrings class
namespace: Serenity.Data assembly: Serenity.Net.Services
The default connection string source.
public class DefaultConnectionStrings : IConnectionKeyFallbacks, IConnectionStrings
| parameter | description |
|---|---|
| options | The connection string options. |
| sqlDialectMapper | The SQL dialect mapper. |
| typeSource | The type source used to discover connection key fallbacks. |
Public Members
| name | description |
|---|---|
| DefaultConnectionStrings(…) | The default connection string source. |
| virtual GetConnectionKeyFallbacks(…) | |
| virtual GetConnectionKeysResolvingTo(…) | Returns all connection keys (including themselves) whose fallback chain resolves to the specified connection key. Only keys that actually resolve to a configured connection are included, so this is a configuration-aware operation. |
| virtual ListConnectionStrings() | Lists all known connection strings. |
| virtual ResolveConnectionKey(…) | |
| virtual TryGetConnectionString(…) | Gets a connection string by its key, resolving any connection key fallbacks. If the specified key is not configured but has a fallback, the fallback connection string is returned. The returned ConnectionKey is the key the connection is actually registered under. |
Protected Members
| name | description |
|---|---|
| readonly byKey | The cached dictionary of connection string infos. |
| fallbackMap | The lazily built connection key fallback map. |
| readonly options | The options. |
| readonly sqlDialectMapper | The SQL dialect mapper. |
| virtual ApplyConfigFallbacks(…) | Applies config-driven fallbacks declared via FallbackFor to the given map. These override any fallback declared by assembly attributes. If two configured connections declare the same connection key in FallbackFor, an InvalidOperationException is thrown because the fallback target is ambiguous. |
| virtual DetermineDialect(…) | Determines the dialect for a connection. |
| virtual GetFallbackMap() | Gets the connection key fallback map. The default implementation builds it lazily on first access and caches it in fallbackMap. Override to change caching or invalidation behavior, e.g. to return a fresh map each access (no caching). |
| static BuildFallbackMap(…) | Builds the connection key fallback map from the given type source. |
Remarks
Creates a new instance of DefaultConnectionStrings.
See Also
- interface IConnectionKeyFallbacks
- interface IConnectionStrings
- Source: DefaultConnectionStrings.cs