DbExtensions.GetValueOrDefaultAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetValueOrDefaultAsync<TValue>(DbDataReader, Int32, TValue) |
Returns a value if it is not DBNull, default(TValue) otherwise. |
GetValueOrDefaultAsync<TValue>(DbDataReader, String, TValue) |
Returns a value if it is not DBNull, default(TValue) otherwise. |
GetValueOrDefaultAsync<TValue>(DbDataReader, Int32, TValue)
Returns a value if it is not DBNull, default(TValue) otherwise.
public static System.Threading.Tasks.Task<TValue> GetValueOrDefaultAsync<TValue> (this System.Data.Common.DbDataReader record, int ordinal, TValue default = default);
static member GetValueOrDefaultAsync : System.Data.Common.DbDataReader * int * 'Value -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetValueOrDefaultAsync(Of TValue) (record As DbDataReader, ordinal As Integer, Optional default As TValue = Nothing) As Task(Of TValue)
Type Parameters
- TValue
The type of the value to request.
Parameters
- record
- DbDataReader
The record from which to retrieve the value.
- ordinal
- Int32
The ordinal of the fieldname.
- default
- TValue
The default value if value in position is DBNull.
Returns
Either the given value or the default for the requested type.
Exceptions
Applies to
GetValueOrDefaultAsync<TValue>(DbDataReader, String, TValue)
Returns a value if it is not DBNull, default(TValue) otherwise.
public static System.Threading.Tasks.Task<TValue> GetValueOrDefaultAsync<TValue> (this System.Data.Common.DbDataReader record, string fieldName, TValue default = default);
static member GetValueOrDefaultAsync : System.Data.Common.DbDataReader * string * 'Value -> System.Threading.Tasks.Task<'Value>
<Extension()>
Public Function GetValueOrDefaultAsync(Of TValue) (record As DbDataReader, fieldName As String, Optional default As TValue = Nothing) As Task(Of TValue)
Type Parameters
- TValue
The type of the value to request.
Parameters
- record
- DbDataReader
The record from which to retrieve the value.
- fieldName
- String
The name of the field to retrieve.
- default
- TValue
The default value if value in position is DBNull.
Returns
Either the given value or the default for the requested type.
Exceptions
Remarks
This function throws if the given does not exist.