Class ThrowHelper
Provides methods to throw common exceptions.
Inherited Members
Namespace: RentADeveloper.DbConnectionPlus
Assembly: RentADeveloper.DbConnectionPlus.dll
Syntax
public static class ThrowHelper
Methods
View SourceThrowConfigurationIsFrozenException()
Throws an InvalidOperationException indicating that the configuration of DbConnectionPlus is frozen and can no longer be modified.
Declaration
[DoesNotReturn]
public static void ThrowConfigurationIsFrozenException()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Always thrown. |
ThrowDatabaseAdapterDoesNotSupportTemporaryTablesException(IDatabaseAdapter)
Throws an NotSupportedException indicating that an attempt was made to use the temporary tables feature of DbConnectionPlus, but the database adapter for the current database system does not support temporary tables.
Declaration
[DoesNotReturn]
public static void ThrowDatabaseAdapterDoesNotSupportTemporaryTablesException(IDatabaseAdapter databaseAdapter)
Parameters
| Type | Name | Description |
|---|---|---|
| IDatabaseAdapter | databaseAdapter | The database adapter that does not support temporary tables. |
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Always thrown. |
ThrowDatabaseOperationAffectedUnexpectedNumberOfRowsException(int, int, object)
Throws an DbUpdateConcurrencyException indicating that a concurrency violation was encountered while deleting or updating an entity in a database. A concurrency violation occurs when an unexpected number of rows are affected by a delete or update operation. This is usually because the data in the database has been modified since the entity has been loaded.
Declaration
[DoesNotReturn]
public static void ThrowDatabaseOperationAffectedUnexpectedNumberOfRowsException(int expectedNumberOfAffectedRows, int actualNumberOfAffectedRows, object entity)
Parameters
| Type | Name | Description |
|---|---|---|
| int | expectedNumberOfAffectedRows | The expected number of affected rows. |
| int | actualNumberOfAffectedRows | The actual number of affected rows. |
| object | entity | The entity that was involved in the operation. |
Exceptions
| Type | Condition |
|---|---|
| DbUpdateConcurrencyException | Always thrown. |
ThrowEntityTypeHasNoKeyPropertyException(Type)
Throws an ArgumentException indicating that the specified entity type has no key property.
Declaration
[DoesNotReturn]
public static void ThrowEntityTypeHasNoKeyPropertyException(Type entityType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | entityType | The entity type that lacks a key property. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Always thrown. |
ThrowInvalidEnumSerializationModeException<T>(EnumSerializationMode)
Throws an ArgumentOutOfRangeException indicating that the specified EnumSerializationMode is invalid.
Declaration
[DoesNotReturn]
public static T ThrowInvalidEnumSerializationModeException<T>(EnumSerializationMode enumSerializationMode)
Parameters
| Type | Name | Description |
|---|---|---|
| EnumSerializationMode | enumSerializationMode | The EnumSerializationMode value that is invalid. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The type parameter for the return value of this method. This just exists to satisfy the compiler when this method is used in an expression or when we must trick the compiler to believe a value is returned. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Always thrown. |
ThrowSqlStatementReturnedMoreThanOneRowException()
Throws an InvalidOperationException indicating that an SQL statement did return more than one row when it was expected to return just one.
Declaration
[DoesNotReturn]
public static void ThrowSqlStatementReturnedMoreThanOneRowException()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Always thrown. |
ThrowSqlStatementReturnedNoRowsException()
Throws an InvalidOperationException indicating that an SQL statement did not return any rows when it was expected to.
Declaration
[DoesNotReturn]
public static void ThrowSqlStatementReturnedNoRowsException()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Always thrown. |
ThrowWrongConnectionTypeException<TExpectedConnectionType, T>()
Throws an ArgumentOutOfRangeException indicating that the specified connection is not of the expected type.
Declaration
[DoesNotReturn]
public static T ThrowWrongConnectionTypeException<TExpectedConnectionType, T>() where TExpectedConnectionType : DbConnection
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| TExpectedConnectionType | The type of connection that was expected. |
| T | The type parameter for the return value of this method. This just exists to satisfy the compiler when this method is used in an expression or when we must trick the compiler to believe a value is returned. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Always thrown. |
ThrowWrongTransactionTypeException<TExpectedTransactionType, T>()
Throws an ArgumentOutOfRangeException indicating that the specified transaction is not of the expected type.
Declaration
[DoesNotReturn]
public static T ThrowWrongTransactionTypeException<TExpectedTransactionType, T>() where TExpectedTransactionType : DbTransaction
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| TExpectedTransactionType | The type of transaction that was expected. |
| T | The type parameter for the return value of this method. This just exists to satisfy the compiler when this method is used in an expression or when we must trick the compiler to believe a value is returned. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Always thrown. |