Class DbConnectionExtensions
Contains extension methods for System.Data.Common.DbConnection to extend database connection capabilities.
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Infrastructure.dll
Syntax
public static class DbConnectionExtensions
Methods
View SourceIsAvailable(IDbConnection)
Checks whether the specified database connection is available by attempting to open and close it.
Declaration
public static bool IsAvailable(this IDbConnection connection)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbConnection | connection | The System.Data.IDbConnection to test for availability. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsConnectionAvailable(string?, DbProviderFactory?)
Determines whether a database connection can be successfully opened using the specified connection string and provider factory.
Declaration
public static bool IsConnectionAvailable(string? connectionString, DbProviderFactory? factory)
Parameters
| Type | Name | Description |
|---|---|---|
| string | connectionString | The connection string used to establish the database connection. |
| DbProviderFactory | factory | The database provider factory used to create the connection. |
Returns
| Type | Description |
|---|---|
| bool | True if the connection is available and can be opened; otherwise, false. |