示例#1
0
        public static IDbCommand AddArrayParameters <T>(this IDbCommand cmd, string name, DbType type, T[] values)
        {
            name = name.StartsWith("@") ? name : "@" + name;
            var names = string.Join(", ", values.Select((value, i) =>
            {
                var paramName = name + i;
                cmd.AddInputParam(paramName, type, value);
                return(paramName);
            }));

            cmd.CommandText = cmd.CommandText.Replace(name, names);
            return(cmd);
        }