Example #1
0
        public static Int16 SafeGetInt16(this IDataReader dataReader, string columnName, Int16 defaultValue = default(Int16))
        {
            ChekArgumentAccuracy(columnName);

            int          columnIndex = GetColumnIndexByName(dataReader, columnName);
            Func <Int16> func        = () => dataReader.GetInt16(columnIndex);

            return(DataReaderFunctorExecutor <Int16> .ExecuteFunction(dataReader, columnIndex, func, defaultValue));
        }
Example #2
0
        public static String SafeGetDateTimeAsFormatedString(this IDataReader dataReader, string columnName, string defaultValue = default(string), string dateTimeFormat = "")
        {
            ChekArgumentAccuracy(columnName);

            int           columnIndex = GetColumnIndexByName(dataReader, columnName);
            Func <String> func        = () => dataReader.GetDateTime(columnIndex).ToString(dateTimeFormat);

            return(DataReaderFunctorExecutor <String> .ExecuteFunction(dataReader, columnIndex, func, defaultValue));
        }
Example #3
0
        public static Char SafeGetChar(this IDataReader dataReader, string columnName, char defaultValue = default(Char))
        {
            ChekArgumentAccuracy(columnName);

            int         columnIndex = GetColumnIndexByName(dataReader, columnName);
            Func <Char> func        = () => dataReader.GetChar(columnIndex);

            return(DataReaderFunctorExecutor <Char> .ExecuteFunction(dataReader, columnIndex, func, defaultValue));
        }
Example #4
0
        public static DateTime SafeGetDateTime(this IDataReader dataReader, string columnName, DateTime defaultValue = default(DateTime))
        {
            ChekArgumentAccuracy(columnName);

            int             columnIndex = GetColumnIndexByName(dataReader, columnName);
            Func <DateTime> func        = () => dataReader.GetDateTime(columnIndex);

            return(DataReaderFunctorExecutor <DateTime> .ExecuteFunction(dataReader, columnIndex, func, defaultValue));
        }
        public static Guid SafeGetGuid(this IDataReader dataReader, string columnName, Guid defaultValue = default(Guid))
        {
            ChekArgumentAccuracy(columnName);

            int         columnIndex = GetColumnIndexByName(dataReader, columnName);
            Func <Guid> func        = () => dataReader.GetGuid(columnIndex);

            return(DataReaderFunctorExecutor <Guid> .ExecuteFunction(dataReader, columnIndex, func, defaultValue));
        }