10#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
11using System.Data.SqlClient;
12using System.Threading.Tasks;
23#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
24 private SqlDataReader _sqlDataReader;
42#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
47#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
56 if (_sqlDataReader ==
null)
57 throw new NotSupportedException(
"GetFieldValueAsync");
58 return _sqlDataReader.GetFieldValueAsync<T>(ordinal);
69 if (_sqlDataReader ==
null)
70 throw new NotSupportedException(
"GetFieldValueAsync");
71 return _sqlDataReader.GetFieldValueAsync<T>(ordinal, cancellationToken);
82 if (_sqlDataReader ==
null)
83 throw new NotSupportedException(
"IsDbNullAsync");
84 return _sqlDataReader.IsDBNullAsync(ordinal);
94 public Task<bool>
IsDbNullAsync(
int ordinal, System.Threading.CancellationToken cancellationToken)
96 if (_sqlDataReader ==
null)
97 throw new NotSupportedException(
"IsDbNullAsync");
98 return _sqlDataReader.IsDBNullAsync(ordinal, cancellationToken);
107 if (_sqlDataReader ==
null)
108 throw new NotSupportedException(
"NextResultAsync");
109 return _sqlDataReader.NextResultAsync();
117 public Task<bool>
NextResultAsync(System.Threading.CancellationToken cancellationToken)
119 if (_sqlDataReader ==
null)
120 throw new NotSupportedException(
"NextResultAsync");
121 return _sqlDataReader.NextResultAsync(cancellationToken);
130 if (_sqlDataReader ==
null)
131 throw new NotSupportedException(
"NextResultAsync");
132 return _sqlDataReader.ReadAsync();
140 public Task<bool>
ReadAsync(System.Threading.CancellationToken cancellationToken)
142 if (_sqlDataReader ==
null)
143 throw new NotSupportedException(
"NextResultAsync");
144 return _sqlDataReader.ReadAsync(cancellationToken);
302 int i,
bool minIsEmpty)
449 public Int64
GetBytes(
string name, Int64 fieldOffset,
450 byte[] buffer,
int bufferOffset,
int length)
452 return GetBytes(
DataReader.GetOrdinal(name), fieldOffset, buffer, bufferOffset, length);
466 public virtual Int64
GetBytes(
int i, Int64 fieldOffset,
467 byte[] buffer,
int bufferOffset,
int length)
472 return DataReader.GetBytes(i, fieldOffset, buffer, bufferOffset, length);
497 return char.MinValue;
500 char[] myChar =
new char[1];
517 public Int64
GetChars(
string name, Int64 fieldOffset,
518 char[] buffer,
int bufferOffset,
int length)
520 return GetChars(
DataReader.GetOrdinal(name), fieldOffset, buffer, bufferOffset, length);
534 public virtual Int64
GetChars(
int i, Int64 fieldOffset,
535 char[] buffer,
int bufferOffset,
int length)
540 return DataReader.GetChars(i, fieldOffset, buffer, bufferOffset, length);
601 return DateTime.MinValue;
628 return DateTimeOffset.MinValue;
630 return (DateTimeOffset)
DataReader.GetValue(i);
830 public object this[
string name]
835 if (DBNull.Value.Equals(val))
846 public virtual object this[
int i]
867#region IDisposable Support
869 private bool _disposedValue;
876 protected virtual void Dispose(
bool disposing)
888 _disposedValue =
true;
898 GC.SuppressFinalize(
this);
This is an IDataReader that 'fixes' any null values before they are returned to our business code.
int GetValues(object[] values)
Invokes the GetValues method of the underlying datareader.
void Dispose()
Disposes the object.
virtual float GetFloat(int i)
Gets a Single value from the datareader.
IDataReader GetData(string name)
Invokes the GetData method of the underlying datareader.
IDataReader DataReader
Get a reference to the underlying data reader object that actually contains the data from the data so...
int RecordsAffected
Returns the RecordsAffected property value from the underlying datareader.
virtual System.Guid GetGuid(int i)
Gets a Guid value from the datareader.
virtual Csla.SmartDate GetSmartDate(int i)
Gets a SmartDate from the datareader.
Task< bool > IsDbNullAsync(int ordinal)
Gets a value indicating whether the column has a null or missing value.
virtual bool GetBoolean(int i)
Gets a boolean value from the datareader.
virtual Int64 GetBytes(int i, Int64 fieldOffset, byte[] buffer, int bufferOffset, int length)
Invokes the GetBytes method of the underlying datareader.
int GetInt32(string name)
Gets an integer from the datareader.
virtual object GetValue(int i)
Gets a value of type System.Object from the datareader.
string GetString(string name)
Gets a string value from the datareader.
Int64 GetChars(string name, Int64 fieldOffset, char[] buffer, int bufferOffset, int length)
Invokes the GetChars method of the underlying datareader.
bool IsClosed
Returns the IsClosed property value from the datareader.
virtual DateTime GetDateTime(string name)
Gets a date value from the datareader.
virtual Csla.SmartDate GetSmartDate(int i, bool minIsEmpty)
Gets a SmartDate from the datareader.
virtual string GetString(int i)
Gets a string value from the datareader.
virtual DateTimeOffset GetDateTimeOffset(int i)
Gets an UTC date value from the datareader.
void Close()
Closes the datareader.
Csla.SmartDate GetSmartDate(string name)
Gets a SmartDate from the datareader.
Task< bool > NextResultAsync()
Advances the reader to the next result.
float GetFloat(string name)
Gets a Single value from the datareader.
virtual Int64 GetChars(int i, Int64 fieldOffset, char[] buffer, int bufferOffset, int length)
Invokes the GetChars method of the underlying datareader.
Int64 GetBytes(string name, Int64 fieldOffset, byte[] buffer, int bufferOffset, int length)
Invokes the GetBytes method of the underlying datareader.
virtual string GetDataTypeName(int i)
Invokes the GetDataTypeName method of the underlying datareader.
string GetDataTypeName(string name)
Invokes the GetDataTypeName method of the underlying datareader.
virtual void Dispose(bool disposing)
Disposes the object.
virtual IDataReader GetData(int i)
Invokes the GetData method of the underlying datareader.
virtual short GetInt16(int i)
Gets a Short value from the datareader.
int Depth
Returns the depth property value from the datareader.
virtual char GetChar(int i)
Gets a char value from the datareader.
bool GetBoolean(string name)
Gets a boolean value from the datareader.
Int64 GetInt64(string name)
Gets a Long value from the datareader.
decimal GetDecimal(string name)
Gets a decimal value from the datareader.
virtual double GetDouble(int i)
Gets a double from the datareader.
Task< bool > IsDbNullAsync(int ordinal, System.Threading.CancellationToken cancellationToken)
Gets a value indicating whether the column has a null or missing value.
bool NextResult()
Moves to the next result set in the datareader.
Task< bool > ReadAsync(System.Threading.CancellationToken cancellationToken)
Advances to the next record in a recordset.
virtual int GetInt32(int i)
Gets an integer from the datareader.
Type GetFieldType(string name)
Invokes the GetFieldType method of the underlying datareader.
Task< T > GetFieldValueAsync< T >(int ordinal)
Asynchronously gets the data value as a type.
object GetValue(string name)
Gets a value of type System.Object from the datareader.
Task< bool > NextResultAsync(System.Threading.CancellationToken cancellationToken)
Advances the reader to the next result.
virtual DateTimeOffset GetDateTimeOffset(string name)
Gets an UTC date value from the datareader.
byte GetByte(string name)
Gets a byte value from the datareader.
virtual Int64 GetInt64(int i)
Gets a Long value from the datareader.
virtual decimal GetDecimal(int i)
Gets a decimal value from the datareader.
virtual bool IsDBNull(int i)
Invokes the IsDBNull method of the underlying datareader.
System.Guid GetGuid(string name)
Gets a Guid value from the datareader.
Task< bool > ReadAsync()
Advances to the next record in a recordset.
virtual Type GetFieldType(int i)
Invokes the GetFieldType method of the underlying datareader.
virtual bool IsDBNull(string name)
Invokes the IsDBNull method of the underlying datareader.
DataTable GetSchemaTable()
Invokes the GetSchemaTable method of the underlying datareader.
virtual byte GetByte(int i)
Gets a byte value from the datareader.
Csla.SmartDate GetSmartDate(string name, bool minIsEmpty)
Gets a SmartDate from the datareader.
int GetOrdinal(string name)
Gets an ordinal value from the datareader.
int FieldCount
Returns the FieldCount property from the datareader.
short GetInt16(string name)
Gets a Short value from the datareader.
virtual DateTime GetDateTime(int i)
Gets a date value from the datareader.
virtual string GetName(int i)
Invokes the GetName method of the underlying datareader.
SafeDataReader(IDataReader dataReader)
Initializes the SafeDataReader object to use data from the provided DataReader object.
bool Read()
Reads the next row of data from the datareader.
char GetChar(string name)
Gets a char value from the datareader.
double GetDouble(string name)
Gets a double from the datareader.
Provides a date data type that understands the concept of an empty date value.