Exemple #1
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Int64}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Int64}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Int64"/> if possible.
        /// </remarks>
        public static long?GetNullableInt64(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetInt64(name));
        }
Exemple #2
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Single}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Single}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Single"/> if possible.
        /// </remarks>
        public static float?GetNullableFloat(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetFloat(name));
        }
Exemple #3
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Guid}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Guid}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Guid"/> if possible.
        /// </remarks>
        public static Guid?GetNullableGuid(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetGuid(name));
        }
Exemple #4
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Decimal}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Decimal}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Decimal"/> if possible.
        /// </remarks>
        public static decimal?GetNullableDecimal(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetDecimal(name));
        }
Exemple #5
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Double}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Double}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Double"/> if possible.
        /// </remarks>
        public static double?GetNullableDouble(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetDouble(name));
        }
Exemple #6
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Boolean}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="name">The name of the column.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Boolean}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Boolean"/> if possible.
        /// </remarks>
        public static bool?GetNullableBoolean(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetBoolean(name));
        }
Exemple #7
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Char}"/>
        /// </summary>
        /// <param name="record">The data record</param>
        /// <param name="name">The name of the column</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Char}"/> </returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Char"/> if possible.
        /// </remarks>
        public static char?GetNullableChar(this IDbDataRecord record, string name)
        {
            if (record.IsDBNull(name))
            {
                return(null);
            }

            return(record.GetChar(name));
        }
Exemple #8
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Guid}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Guid}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Guid"/> if possible.
        /// </remarks>
        public static Guid?GetNullableGuid(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetGuid(index));
        }
Exemple #9
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Int64}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Int64}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Int64"/> if possible.
        /// </remarks>
        public static long?GetNullableInt64(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetInt64(index));
        }
Exemple #10
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Single}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Single}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Single"/> if possible.
        /// </remarks>
        public static float?GetNullableFloat(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetFloat(index));
        }
Exemple #11
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Double}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Double}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Double"/> if possible.
        /// </remarks>
        public static double?GetNullableDouble(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetDouble(index));
        }
Exemple #12
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Decimal}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Decimal}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Decimal"/> if possible.
        /// </remarks>
        public static decimal?GetNullableDecimal(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetDecimal(index));
        }
Exemple #13
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Char}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Char}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Char"/> if possible.
        /// </remarks>
        public static char?GetNullableChar(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetChar(index));
        }
Exemple #14
0
        /// <summary>
        /// Returns the value in the given column converted to <see cref="Nullable{Boolean}"/>.
        /// </summary>
        /// <param name="record">The data record.</param>
        /// <param name="index">The zero-based column ordinal.</param>
        /// <returns>The value in the given column converted to <see cref="Nullable{Boolean}"/>.</returns>
        /// <remarks>
        /// If the value in the column is <see cref="DBNull"/>, <c>null</c> is returned. Otherwise the value is
        /// converted to a <see cref="Boolean"/> if possible.
        /// </remarks>
        public static bool?GetNullableBoolean(this IDbDataRecord record, int index)
        {
            if (record.IsDBNull(index))
            {
                return(null);
            }

            return(record.GetBoolean(index));
        }