IsDBNull() public static method

public static IsDBNull ( object value ) : bool
value object
return bool
Beispiel #1
0
 public static Boolean IsDBNull <T>(this T @this) where T : class
 {
     return(Convert.IsDBNull(@this));
 }
Beispiel #2
0
        /// <summary>
        /// 将指定的执行命令转换成完整字符串形式。
        /// </summary>
        /// <param name="command">执行命令。</param>
        /// <returns>完整执行命令的字符串形式。</returns>
        public static string ToFullString(this ExecuteCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }
            StringBuilder builder = new StringBuilder(command.Text);

            if (command.Parameters != null)
            {
                builder.AppendLine();
                builder.AppendLine("*** Parameters ***");
                foreach (var item in command.Parameters)
                {
                    builder.AppendFormat("{0}\t=\t{1}\r\n", item.Name + (item.Value == null ? string.Empty : " <" + item.Value.GetType().Name + ">"), (item.Value == null || Convert.IsDBNull(item.Value)) ? "<NULL>" : item.Value);
                }
                builder.AppendLine("*** Parameters ***");
            }
            return(builder.ToString());
        }