/// <summary>
        /// Gets the value of the given field from the data reader or null.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="dataRecord">Current IDataRecord object from extension method.</param>
        /// <param name="name">Name of field within IDataRecord.</param>
        /// <returns>The given field's value or null.</returns>
        public static T GetValueOrNull <T>(this IDataRecord dataRecord, string name)
        {
            if (dataRecord == null)
            {
                throw new ArgumentNullException("dataRecord");
            }

            object value = dataRecord[name];

            return(DatabaseValueParser.GetValueOrNull <T>(value));
        }
        /// <summary>
        /// Gets the value of the given field from the data reader or the
        /// default for the object type.
        /// </summary>
        /// <typeparam name="T">Type of object.</typeparam>
        /// <param name="dataRecord">Current IDataRecord object from extension method.</param>
        /// <param name="index">Index of field within IDataRecord.</param>
        /// <param name="defaultValue">Value to use if null field value.</param>
        /// <returns>The given field's value or the given default.</returns>
        public static T GetValueOrDefault <T>(this IDataRecord dataRecord, int index, T defaultValue)
        {
            if (dataRecord == null)
            {
                throw new ArgumentNullException("dataRecord");
            }

            object value = dataRecord[index];

            return(DatabaseValueParser.GetValueOrDefault(value, defaultValue));
        }