TableAdapterはpartialなクラスなので、ウィザードで作成できないメソッドを別のファイルに実装することができます。
今回はパラメータ数が動的に変わるメソッドを実装してみました。
using Devart.Data.PostgreSql; using Models; using System.ComponentModel; namespace Models.HogeDataSetTableAdapters { public partial class UserInfoTableAdapter { [DataObjectMethod(DataObjectMethodType.Select)] public HogeDataSet.UserInfoDataTable GetDataByUsersID(params string[] usersID) { HogeDataSet.UserInfoDataTable t = new HogeDataSet.UserInfoDataTable(); FillByUsersID(t, usersID); return t; } [DataObjectMethod(DataObjectMethodType.Fill)] public void FillByUsersID(HogeDataSet.UserInfoDataTable userInfo, params string[] usersID) { using(PgSqlCommand commmand = new PgSqlCommand()) { commmand.Connection = this.Connection; commmand.CommandText = string.Format( "SELECT * FROM UserInfo WHERE ID {0})", SqlHelper.GetInConditionAndSetParameters(commmand.Parameters, usersID)); using(PgSqlDataAdapter adapter = new PgSqlDataAdapter(commmand)) { adapter.Fill(userInfo); } } } } internal static class SqlHelper { internal static string GetInConditionAndSetParameters(PgSqlParameterCollection parameters, params string[] keys) { StringBuilder condition = new StringBuilder("IN ("); for(int i = 0; i < keys.Length; i++) { string parameterName = string.Format("parameter{0}", i + 1); condition.AppendFormat(":{0},", parameterName); parameters.Add(parameterName, keys[i]); } condition.Length--; condition.Append(")"); return condition.ToString(); } } }