예제 #1
0
        public static T GetValueOrDefault <T>(this DataRow dataRow, string name)
        {
            Assert.IsNotNull(dataRow, nameof(dataRow));
            var value = dataRow[name];

            return(ValueReader.GetValueOrDefault <T>(value));
        }
예제 #2
0
        public static T GetValueOrDefault <T>(this DataRow dataRow, int columnIndex)
        {
            Assert.IsNotNull(dataRow, nameof(dataRow));
            var value = dataRow[columnIndex];

            return(ValueReader.GetValueOrDefault <T>(value));
        }
예제 #3
0
        public static T GetValue <T>(this DataRow dataRow, string name, T outputNullValue)
        {
            Assert.IsNotNull(dataRow, nameof(dataRow));
            var valueObject = dataRow[name];

            return(ValueReader.GetValue(valueObject, outputNullValue));
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="command"></param>
        /// <returns></returns>
        public static T ExecuteScalarValueOrDefault <T>(this IDbCommand command)
        {
            Assert.IsNotNull(command);

            var scalar = command.ExecuteScalar();

            return(ValueReader.GetValueOrDefault <T>(scalar));
        }
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public static T GetValueOrDefault <T>(this IDataParameter parameter)
 {
     return(ValueReader.GetValueOrDefault <T>(parameter.Value));
 }
 public static T GetValueOrDefault <T>(this IDataParameter parameter) => ValueReader.GetValueOrDefault <T>(parameter.Value);