public static void AddParameter(this IDbCommand command, string name, DbType? type, object value) { var param = command.CreateParameter(); param.ParameterName = name; param.Value = value; param.DbType = type.GetValueOrDefault(param.DbType); command.Parameters.Add(param); }