Class DbParameterExtensions
This class adds extension methods which simplify getting typed .NET values from (output) parameters. Because these methods reference the abstract DbParameterCollection, these methods are available in the derived classes:
Inheritance
Inherited Members
Namespace: ArgentSea
Assembly: ArgentSea.dll
Syntax
public static class DbParameterExtensions
Methods
| Improve this Doc View SourceGetBoolean(DbParameter)
Gets a Boolean value from the output parameter.
Declaration
public static bool GetBoolean(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Boolean | The parameter value as a Boolean. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetByte(DbParameter)
Gets a byte value from the output parameter.
Declaration
public static byte GetByte(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Byte | The parameter value as a byte array. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetBytes(DbParameter)
Gets a byte array from the output parameter, or null if the parameter value is DbNull.
Declaration
public static byte[] GetBytes(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Byte[] | The parameter value as a byte[]. |
GetDateTime(DbParameter)
Gets a DateTime value from the output parameter.
Declaration
public static DateTime GetDateTime(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.DateTime | The parameter value as a DateTime. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetDateTimeOffset(DbParameter)
Gets a DateTimeOffset value from the output parameter.
Declaration
public static DateTimeOffset GetDateTimeOffset(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.DateTimeOffset | The parameter value as a DateTimeOffset. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetDecimal(DbParameter)
Gets a Decimal value from the output parameter.
Declaration
public static decimal GetDecimal(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Decimal | The parameter value as a Decimal. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetDouble(DbParameter)
Gets a Double (64-bit floating point) value from the output parameter, or NaN (Not a Number) if the value is DbNull.
Declaration
public static double GetDouble(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Double | The parameter value as a Double. |
GetFloat(DbParameter)
Gets a Float (32-bit floating point) value from the output parameter, or NaN (Not a Number) if the value is DbNull.
Declaration
public static float GetFloat(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Single | The parameter value as a Float. |
GetGuid(DbParameter)
Gets a Guid value from the output parameter, or Guid.Emtpy if the value is DbNull.
Declaration
public static Guid GetGuid(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Guid | The parameter value as a Guid. |
GetInteger(DbParameter)
Gets an Int32 value from the output parameter.
Declaration
public static int GetInteger(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Int32 | The parameter value as an Int32. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetLong(DbParameter)
Gets an Int64 value from the output parameter.
Declaration
public static long GetLong(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Int64 | The parameter value as an Int64. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetNullableBoolean(DbParameter)
Gets a Nullable<Boolean> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static bool? GetNullableBoolean(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> | The parameter value as a Nullable<Boolean>. |
GetNullableByte(DbParameter)
Gets a Nullable<Byte> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static byte? GetNullableByte(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Byte> | The parameter value as a Nullable<Byte>. |
GetNullableDateTime(DbParameter)
Gets a Nullable<DateTime>) value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static DateTime? GetNullableDateTime(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | The parameter value as a Nullable<DateTime>. |
GetNullableDateTimeOffset(DbParameter)
Gets a Nullable<DateTimeOffset> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static DateTimeOffset? GetNullableDateTimeOffset(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.DateTimeOffset> | The parameter value as a Nullable<DateTimeOffset>. |
GetNullableDecimal(DbParameter)
Gets a Nullable<Decimal> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static decimal? GetNullableDecimal(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Decimal> | The parameter value as a Nullable<Decimal>. |
GetNullableDouble(DbParameter)
Gets a Nullable<Double> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static double? GetNullableDouble(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Double> | The parameter value as a Nullable<Double>. |
GetNullableFloat(DbParameter)
Gets a Nullable<Float> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static float? GetNullableFloat(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Single> | The parameter value as a Nullable<Float>. |
GetNullableGuid(DbParameter)
Gets a Nullable<Guid> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static Guid? GetNullableGuid(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Guid> | The parameter value as a Nullable<Guid>. |
GetNullableInteger(DbParameter)
Gets a Nullable<Int32> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static int? GetNullableInteger(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> | The parameter value as a Nullable<Int32>. |
GetNullableLong(DbParameter)
Gets a Nullable<Int64> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static long? GetNullableLong(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Int64> | The parameter value as a Nullable<Int64>. |
GetNullableShort(DbParameter)
Gets a Nullable<Int16> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static short? GetNullableShort(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | The parameter value as a Nullable<Int16>. |
GetNullableTimeSpan(DbParameter)
Gets a Nullable<TimeSpan> value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static TimeSpan? GetNullableTimeSpan(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The parameter value as a Nullable<TimeSpan>. |
GetShort(DbParameter)
Gets a short (Int16) value from the output parameter.
Declaration
public static short GetShort(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.Int16 | The parameter value as an Int16. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |
GetString(DbParameter)
Gets a string value from the output parameter, or null if the parameter value is DbNull.
Declaration
public static string GetString(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.String | The parameter value as a string. |
GetTimeSpan(DbParameter)
Gets a TimeSpan value from the output parameter.
Declaration
public static TimeSpan GetTimeSpan(this DbParameter prm)
Parameters
Type | Name | Description |
---|---|---|
System.Data.Common.DbParameter | prm | The output parameter, populated with a value (after Execute). |
Returns
Type | Description |
---|---|
System.TimeSpan | The parameter value as a TimeSpan. |
Exceptions
Type | Condition |
---|---|
ArgentSea.UnexpectedNullException | Thrown when a database null value is encountered. |