This is an IDataReader that 'fixes' any null values before they are returned to our business code. More...
Public Member Functions | |
SafeDataReader (IDataReader dataReader) | |
Initializes the SafeDataReader object to use data from the provided DataReader object. More... | |
Task< T > | GetFieldValueAsync< T > (int ordinal) |
Asynchronously gets the data value as a type. More... | |
Task< T > | GetFieldValueAsync< T > (int ordinal, System.Threading.CancellationToken cancellationToken) |
Asynchronously gets the data value as a type. More... | |
Task< bool > | IsDbNullAsync (int ordinal) |
Gets a value indicating whether the column has a null or missing value. More... | |
Task< bool > | IsDbNullAsync (int ordinal, System.Threading.CancellationToken cancellationToken) |
Gets a value indicating whether the column has a null or missing value. More... | |
Task< bool > | NextResultAsync () |
Advances the reader to the next result. More... | |
Task< bool > | NextResultAsync (System.Threading.CancellationToken cancellationToken) |
Advances the reader to the next result. More... | |
Task< bool > | ReadAsync () |
Advances to the next record in a recordset. More... | |
Task< bool > | ReadAsync (System.Threading.CancellationToken cancellationToken) |
Advances to the next record in a recordset. More... | |
string | GetString (string name) |
Gets a string value from the datareader. More... | |
virtual string | GetString (int i) |
Gets a string value from the datareader. More... | |
object | GetValue (string name) |
Gets a value of type System.Object from the datareader. More... | |
virtual object | GetValue (int i) |
Gets a value of type System.Object from the datareader. More... | |
int | GetInt32 (string name) |
Gets an integer from the datareader. More... | |
virtual int | GetInt32 (int i) |
Gets an integer from the datareader. More... | |
double | GetDouble (string name) |
Gets a double from the datareader. More... | |
virtual double | GetDouble (int i) |
Gets a double from the datareader. More... | |
Csla.SmartDate | GetSmartDate (string name) |
Gets a SmartDate from the datareader. More... | |
virtual Csla.SmartDate | GetSmartDate (int i) |
Gets a SmartDate from the datareader. More... | |
Csla.SmartDate | GetSmartDate (string name, bool minIsEmpty) |
Gets a SmartDate from the datareader. More... | |
virtual Csla.SmartDate | GetSmartDate (int i, bool minIsEmpty) |
Gets a SmartDate from the datareader. More... | |
System.Guid | GetGuid (string name) |
Gets a Guid value from the datareader. More... | |
virtual System.Guid | GetGuid (int i) |
Gets a Guid value from the datareader. More... | |
bool | Read () |
Reads the next row of data from the datareader. More... | |
bool | NextResult () |
Moves to the next result set in the datareader. More... | |
void | Close () |
Closes the datareader. More... | |
bool | GetBoolean (string name) |
Gets a boolean value from the datareader. More... | |
virtual bool | GetBoolean (int i) |
Gets a boolean value from the datareader. More... | |
byte | GetByte (string name) |
Gets a byte value from the datareader. More... | |
virtual byte | GetByte (int i) |
Gets a byte value from the datareader. More... | |
Int64 | GetBytes (string name, Int64 fieldOffset, byte[] buffer, int bufferOffset, int length) |
Invokes the GetBytes method of the underlying datareader. More... | |
virtual Int64 | GetBytes (int i, Int64 fieldOffset, byte[] buffer, int bufferOffset, int length) |
Invokes the GetBytes method of the underlying datareader. More... | |
char | GetChar (string name) |
Gets a char value from the datareader. More... | |
virtual char | GetChar (int i) |
Gets a char value from the datareader. More... | |
Int64 | GetChars (string name, Int64 fieldOffset, char[] buffer, int bufferOffset, int length) |
Invokes the GetChars method of the underlying datareader. More... | |
virtual Int64 | GetChars (int i, Int64 fieldOffset, char[] buffer, int bufferOffset, int length) |
Invokes the GetChars method of the underlying datareader. More... | |
IDataReader | GetData (string name) |
Invokes the GetData method of the underlying datareader. More... | |
virtual IDataReader | GetData (int i) |
Invokes the GetData method of the underlying datareader. More... | |
string | GetDataTypeName (string name) |
Invokes the GetDataTypeName method of the underlying datareader. More... | |
virtual string | GetDataTypeName (int i) |
Invokes the GetDataTypeName method of the underlying datareader. More... | |
virtual DateTime | GetDateTime (string name) |
Gets a date value from the datareader. More... | |
virtual DateTime | GetDateTime (int i) |
Gets a date value from the datareader. More... | |
virtual DateTimeOffset | GetDateTimeOffset (string name) |
Gets an UTC date value from the datareader. More... | |
virtual DateTimeOffset | GetDateTimeOffset (int i) |
Gets an UTC date value from the datareader. More... | |
decimal | GetDecimal (string name) |
Gets a decimal value from the datareader. More... | |
virtual decimal | GetDecimal (int i) |
Gets a decimal value from the datareader. More... | |
Type | GetFieldType (string name) |
Invokes the GetFieldType method of the underlying datareader. More... | |
virtual Type | GetFieldType (int i) |
Invokes the GetFieldType method of the underlying datareader. More... | |
float | GetFloat (string name) |
Gets a Single value from the datareader. More... | |
virtual float | GetFloat (int i) |
Gets a Single value from the datareader. More... | |
short | GetInt16 (string name) |
Gets a Short value from the datareader. More... | |
virtual short | GetInt16 (int i) |
Gets a Short value from the datareader. More... | |
Int64 | GetInt64 (string name) |
Gets a Long value from the datareader. More... | |
virtual Int64 | GetInt64 (int i) |
Gets a Long value from the datareader. More... | |
virtual string | GetName (int i) |
Invokes the GetName method of the underlying datareader. More... | |
int | GetOrdinal (string name) |
Gets an ordinal value from the datareader. More... | |
DataTable | GetSchemaTable () |
Invokes the GetSchemaTable method of the underlying datareader. More... | |
int | GetValues (object[] values) |
Invokes the GetValues method of the underlying datareader. More... | |
virtual bool | IsDBNull (int i) |
Invokes the IsDBNull method of the underlying datareader. More... | |
virtual bool | IsDBNull (string name) |
Invokes the IsDBNull method of the underlying datareader. More... | |
void | Dispose () |
Disposes the object. More... | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
Disposes the object. More... | |
Properties | |
IDataReader | DataReader [get] |
Get a reference to the underlying data reader object that actually contains the data from the data source. More... | |
int | Depth [get] |
Returns the depth property value from the datareader. More... | |
int | FieldCount [get] |
Returns the FieldCount property from the datareader. More... | |
bool | IsClosed [get] |
Returns the IsClosed property value from the datareader. More... | |
object | this[string name] [get] |
Returns a value from the datareader. More... | |
virtual object | this[int i] [get] |
Returns a value from the datareader. More... | |
int | RecordsAffected [get] |
Returns the RecordsAffected property value from the underlying datareader. More... | |
This is an IDataReader that 'fixes' any null values before they are returned to our business code.
Definition at line 21 of file SafeDataReader.cs.
Csla.Data.SafeDataReader.SafeDataReader | ( | IDataReader | dataReader | ) |
Initializes the SafeDataReader object to use data from the provided DataReader object.
dataReader | The source DataReader object containing the data. |
Definition at line 39 of file SafeDataReader.cs.
void Csla.Data.SafeDataReader.Close | ( | ) |
Closes the datareader.
Definition at line 357 of file SafeDataReader.cs.
void Csla.Data.SafeDataReader.Dispose | ( | ) |
Disposes the object.
Definition at line 894 of file SafeDataReader.cs.
|
protectedvirtual |
Disposes the object.
disposing | True if called by the public Dispose method. |
Definition at line 876 of file SafeDataReader.cs.
|
virtual |
Gets a boolean value from the datareader.
Returns false for null.
i | Ordinal column position of the value. |
Definition at line 403 of file SafeDataReader.cs.
bool Csla.Data.SafeDataReader.GetBoolean | ( | string | name | ) |
Gets a boolean value from the datareader.
Returns false for null.
name | Name of the column containing the value. |
Definition at line 391 of file SafeDataReader.cs.
|
virtual |
Gets a byte value from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 430 of file SafeDataReader.cs.
byte Csla.Data.SafeDataReader.GetByte | ( | string | name | ) |
Gets a byte value from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 418 of file SafeDataReader.cs.
|
virtual |
Invokes the GetBytes method of the underlying datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
buffer | Array containing the data. |
bufferOffset | Offset position within the buffer. |
fieldOffset | Offset position within the field. |
length | Length of data to read. |
Definition at line 466 of file SafeDataReader.cs.
Int64 Csla.Data.SafeDataReader.GetBytes | ( | string | name, |
Int64 | fieldOffset, | ||
byte[] | buffer, | ||
int | bufferOffset, | ||
int | length | ||
) |
Invokes the GetBytes method of the underlying datareader.
Returns 0 for null.
name | Name of the column containing the value. |
buffer | Array containing the data. |
bufferOffset | Offset position within the buffer. |
fieldOffset | Offset position within the field. |
length | Length of data to read. |
Definition at line 449 of file SafeDataReader.cs.
|
virtual |
Gets a char value from the datareader.
Returns Char.MinValue for null.
i | Ordinal column position of the value. |
Definition at line 494 of file SafeDataReader.cs.
char Csla.Data.SafeDataReader.GetChar | ( | string | name | ) |
Gets a char value from the datareader.
Returns Char.MinValue for null.
name | Name of the column containing the value. |
Definition at line 482 of file SafeDataReader.cs.
|
virtual |
Invokes the GetChars method of the underlying datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
buffer | Array containing the data. |
bufferOffset | Offset position within the buffer. |
fieldOffset | Offset position within the field. |
length | Length of data to read. |
Definition at line 534 of file SafeDataReader.cs.
Int64 Csla.Data.SafeDataReader.GetChars | ( | string | name, |
Int64 | fieldOffset, | ||
char[] | buffer, | ||
int | bufferOffset, | ||
int | length | ||
) |
Invokes the GetChars method of the underlying datareader.
Returns 0 for null.
name | Name of the column containing the value. |
buffer | Array containing the data. |
bufferOffset | Offset position within the buffer. |
fieldOffset | Offset position within the field. |
length | Length of data to read. |
Definition at line 517 of file SafeDataReader.cs.
|
virtual |
Invokes the GetData method of the underlying datareader.
i | Ordinal column position of the value. |
Definition at line 556 of file SafeDataReader.cs.
IDataReader Csla.Data.SafeDataReader.GetData | ( | string | name | ) |
Invokes the GetData method of the underlying datareader.
name | Name of the column containing the value. |
Definition at line 547 of file SafeDataReader.cs.
|
virtual |
Invokes the GetDataTypeName method of the underlying datareader.
i | Ordinal column position of the value. |
Definition at line 574 of file SafeDataReader.cs.
string Csla.Data.SafeDataReader.GetDataTypeName | ( | string | name | ) |
Invokes the GetDataTypeName method of the underlying datareader.
name | Name of the column containing the value. |
Definition at line 565 of file SafeDataReader.cs.
|
virtual |
Gets a date value from the datareader.
Returns DateTime.MinValue for null.
i | Ordinal column position of the value. |
Definition at line 598 of file SafeDataReader.cs.
|
virtual |
Gets a date value from the datareader.
Returns DateTime.MinValue for null.
name | Name of the column containing the value. |
Definition at line 586 of file SafeDataReader.cs.
|
virtual |
Gets an UTC date value from the datareader.
Returns DateTimeOffset.MinValue for null.
i | Ordinal column position of the value. |
Definition at line 625 of file SafeDataReader.cs.
|
virtual |
Gets an UTC date value from the datareader.
Returns DateTimeOffset.MinValue for null.
name | Name of the column containing the value. |
Definition at line 613 of file SafeDataReader.cs.
|
virtual |
Gets a decimal value from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 652 of file SafeDataReader.cs.
decimal Csla.Data.SafeDataReader.GetDecimal | ( | string | name | ) |
Gets a decimal value from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 640 of file SafeDataReader.cs.
|
virtual |
Gets a double from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 243 of file SafeDataReader.cs.
double Csla.Data.SafeDataReader.GetDouble | ( | string | name | ) |
Gets a double from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 231 of file SafeDataReader.cs.
|
virtual |
Invokes the GetFieldType method of the underlying datareader.
i | Ordinal column position of the value. |
Definition at line 673 of file SafeDataReader.cs.
Type Csla.Data.SafeDataReader.GetFieldType | ( | string | name | ) |
Invokes the GetFieldType method of the underlying datareader.
name | Name of the column containing the value. |
Definition at line 664 of file SafeDataReader.cs.
Task< T > Csla.Data.SafeDataReader.GetFieldValueAsync< T > | ( | int | ordinal | ) |
Asynchronously gets the data value as a type.
T | Type of value |
ordinal | Ordinal position of value |
Definition at line 54 of file SafeDataReader.cs.
Task< T > Csla.Data.SafeDataReader.GetFieldValueAsync< T > | ( | int | ordinal, |
System.Threading.CancellationToken | cancellationToken | ||
) |
Asynchronously gets the data value as a type.
T | Type of value |
ordinal | Ordinal position of value |
cancellationToken | Async cancellation token |
Definition at line 67 of file SafeDataReader.cs.
|
virtual |
Gets a Single value from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 697 of file SafeDataReader.cs.
float Csla.Data.SafeDataReader.GetFloat | ( | string | name | ) |
Gets a Single value from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 685 of file SafeDataReader.cs.
|
virtual |
Gets a Guid value from the datareader.
Returns Guid.Empty for null.
i | Ordinal column position of the value. |
Definition at line 330 of file SafeDataReader.cs.
System.Guid Csla.Data.SafeDataReader.GetGuid | ( | string | name | ) |
Gets a Guid value from the datareader.
Returns Guid.Empty for null.
name | Name of the column containing the value. |
Definition at line 318 of file SafeDataReader.cs.
|
virtual |
Gets a Short value from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 724 of file SafeDataReader.cs.
short Csla.Data.SafeDataReader.GetInt16 | ( | string | name | ) |
Gets a Short value from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 712 of file SafeDataReader.cs.
|
virtual |
Gets an integer from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 216 of file SafeDataReader.cs.
int Csla.Data.SafeDataReader.GetInt32 | ( | string | name | ) |
Gets an integer from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 204 of file SafeDataReader.cs.
|
virtual |
Gets a Long value from the datareader.
Returns 0 for null.
i | Ordinal column position of the value. |
Definition at line 751 of file SafeDataReader.cs.
Int64 Csla.Data.SafeDataReader.GetInt64 | ( | string | name | ) |
Gets a Long value from the datareader.
Returns 0 for null.
name | Name of the column containing the value. |
Definition at line 739 of file SafeDataReader.cs.
|
virtual |
Invokes the GetName method of the underlying datareader.
i | Ordinal column position of the value. |
Definition at line 763 of file SafeDataReader.cs.
int Csla.Data.SafeDataReader.GetOrdinal | ( | string | name | ) |
Gets an ordinal value from the datareader.
name | Name of the column containing the value. |
Definition at line 772 of file SafeDataReader.cs.
DataTable Csla.Data.SafeDataReader.GetSchemaTable | ( | ) |
Invokes the GetSchemaTable method of the underlying datareader.
Definition at line 780 of file SafeDataReader.cs.
|
virtual |
Gets a SmartDate from the datareader.
A null is converted into the min possible date See Chapter 5 for more details on the SmartDate class.
i | Ordinal column position of the value. |
Definition at line 272 of file SafeDataReader.cs.
|
virtual |
Gets a SmartDate from the datareader.
i | Ordinal column position of the value. |
minIsEmpty | A flag indicating whether the min or max value of a data means an empty date. |
Definition at line 301 of file SafeDataReader.cs.
Csla.SmartDate Csla.Data.SafeDataReader.GetSmartDate | ( | string | name | ) |
Gets a SmartDate from the datareader.
A null is converted into min possible date See Chapter 5 for more details on the SmartDate class.
name | Name of the column containing the value. |
Definition at line 259 of file SafeDataReader.cs.
Csla.SmartDate Csla.Data.SafeDataReader.GetSmartDate | ( | string | name, |
bool | minIsEmpty | ||
) |
Gets a SmartDate from the datareader.
A null is converted into either the min or max possible date depending on the MinIsEmpty parameter. See Chapter 5 for more details on the SmartDate class.
name | Name of the column containing the value. |
minIsEmpty | A flag indicating whether the min or max value of a data means an empty date. |
Definition at line 289 of file SafeDataReader.cs.
|
virtual |
Gets a string value from the datareader.
Returns empty string for null.
i | Ordinal column position of the value. |
Definition at line 167 of file SafeDataReader.cs.
string Csla.Data.SafeDataReader.GetString | ( | string | name | ) |
Gets a string value from the datareader.
Returns empty string for null.
name | Name of the column containing the value. |
Definition at line 155 of file SafeDataReader.cs.
|
virtual |
Gets a value of type System.Object from the datareader.
i | Ordinal column position of the value. |
Definition at line 189 of file SafeDataReader.cs.
object Csla.Data.SafeDataReader.GetValue | ( | string | name | ) |
Gets a value of type System.Object from the datareader.
name | Name of the column containing the value. |
Definition at line 180 of file SafeDataReader.cs.
int Csla.Data.SafeDataReader.GetValues | ( | object[] | values | ) |
Invokes the GetValues method of the underlying datareader.
values | An array of System.Object to copy the values into. |
Definition at line 791 of file SafeDataReader.cs.
|
virtual |
Invokes the IsDBNull method of the underlying datareader.
i | Ordinal column position of the value. |
Definition at line 811 of file SafeDataReader.cs.
|
virtual |
Invokes the IsDBNull method of the underlying datareader.
name | Name of the column containing the value. |
Definition at line 820 of file SafeDataReader.cs.
Task< bool > Csla.Data.SafeDataReader.IsDbNullAsync | ( | int | ordinal | ) |
Gets a value indicating whether the column has a null or missing value.
ordinal | Ordinal position of value |
Definition at line 80 of file SafeDataReader.cs.
Task< bool > Csla.Data.SafeDataReader.IsDbNullAsync | ( | int | ordinal, |
System.Threading.CancellationToken | cancellationToken | ||
) |
Gets a value indicating whether the column has a null or missing value.
ordinal | Ordinal position of value |
cancellationToken | Async cancellation token |
Definition at line 94 of file SafeDataReader.cs.
bool Csla.Data.SafeDataReader.NextResult | ( | ) |
Moves to the next result set in the datareader.
Definition at line 349 of file SafeDataReader.cs.
Task< bool > Csla.Data.SafeDataReader.NextResultAsync | ( | ) |
Task< bool > Csla.Data.SafeDataReader.NextResultAsync | ( | System.Threading.CancellationToken | cancellationToken | ) |
Advances the reader to the next result.
cancellationToken | Async cancellation token |
Definition at line 117 of file SafeDataReader.cs.
bool Csla.Data.SafeDataReader.Read | ( | ) |
Reads the next row of data from the datareader.
Definition at line 341 of file SafeDataReader.cs.
Task< bool > Csla.Data.SafeDataReader.ReadAsync | ( | ) |
Advances to the next record in a recordset.
Definition at line 128 of file SafeDataReader.cs.
Task< bool > Csla.Data.SafeDataReader.ReadAsync | ( | System.Threading.CancellationToken | cancellationToken | ) |
Advances to the next record in a recordset.
cancellationToken | Async cancellation token |
Definition at line 140 of file SafeDataReader.cs.
|
getprotected |
Get a reference to the underlying data reader object that actually contains the data from the data source.
Definition at line 32 of file SafeDataReader.cs.
|
get |
Returns the depth property value from the datareader.
Definition at line 365 of file SafeDataReader.cs.
|
get |
Returns the FieldCount property from the datareader.
Definition at line 376 of file SafeDataReader.cs.
|
get |
Returns the IsClosed property value from the datareader.
Definition at line 799 of file SafeDataReader.cs.
|
get |
Returns the RecordsAffected property value from the underlying datareader.
Definition at line 859 of file SafeDataReader.cs.
|
get |
Returns a value from the datareader.
i | Ordinal column position of the value. |
Definition at line 846 of file SafeDataReader.cs.
|
get |
Returns a value from the datareader.
name | Name of the column containing the value. |
Definition at line 830 of file SafeDataReader.cs.