Dapperは、クエリパラメーターを匿名オブジェクトとして渡すことができ、任意のADO.NETデータプロバイダーをサポートします。ただし、Sybase15ADO.NETドライバに対して次のクエリを実行する場合は次のようになります。
using (var connection = new AseConnection("..."))
{
connection.Open();
var results = connection.Query<Foo>(
"dbo.sp_columns", new { table_name = "dbo.sysusers"},
commandType: CommandType.StoredProcedure);
}
...次のエラーがスローされます:
Sybase.Data.AseClient.AseException: Procedure sp_columns expects parameter @table_name, which was not supplied.
at Sybase.Data.AseClient.AseCommand.ᜁ(Int32 A_0)
at Sybase.Data.AseClient.AseCommand.ᜄ()
at Sybase.Data.AseClient.AseCommand.ᜀ(CommandBehavior A_0)
at Sybase.Data.AseClient.AseCommand.System.Data.IDbCommand.ExecuteReader()
at Dapper.SqlMapper.<QueryInternal>d__13`1.MoveNext() in SqlMapper.cs: line 579
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in SqlMapper.cs: line 536
「@table_name」が設定されたDapperに変更してDynamicParameters
も機能しません。
強く型付けされたパラメータをDapperを使用してSybaseに渡すにはどうすればよいですか?