Class DataExtensions
Extensions for various data classes.
Inheritance
System.Object
DataExtensions
Namespace: Kros.Data
Assembly: Kros.Utils.dll
Syntax
public static class DataExtensions
Methods
IsOpened(IDbConnection)
Checks if database connection is opened.
Declaration
public static bool IsOpened(this IDbConnection cn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDbConnection | cn | Database connection. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if database connection is opened, false otherwise. |
SqlServerErrorCode(SqlException)
Returns error code for Microsoft SQL Server.
Declaration
public static SqlServerErrorCode SqlServerErrorCode(this SqlException ex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.SqlClient.SqlException | ex | Exception of which error code is tested. |
Returns
| Type | Description |
|---|---|
| SqlServerErrorCode | Error code as a value of enumeration SqlServerErrorCode(SqlException). If error code is not defined in the enum, value Unknown is returned. |
Remarks
Method checks value of System.Data.SqlClient.SqlError.Number property of the first error in the System.Data.SqlClient.SqlException.Errors list.