我正在尝试使用Dapper连接Snowflake数据库中编写的过程。每次运行代码时,我都会得到不支持的功能在www.example.com中使用相同的存储过程ADO.net,它工作正常。
下面是我正在使用的代码
public async Task<IEnumerable<TestClass>> GetTestData()
{
IEnumerable<TestClass> response = new List<TestClass>();
using (IDbConnection dbConnection = this.databaseConnection.GetSnowConnection())
{
IEnumerable<TestClass> result = new List<TestClass>();
try
{
result = await dbConnection.QueryAsync<TestClass>("CALL TESTSP1", commandType: CommandType.StoredProcedure, commandTimeout: 0);
response = response.Concat(result);
return response;
}
catch (Exception ex)
{
throw ex;
}
}
}`
1条答案
按热度按时间wz8daaqr1#
看起来不管什么原因,Snowflake都不支持
CommandType.StoredProcedure
。顺便说一句,如果你打算使用它,那么你会去掉CALL
部分。只需使用默认值
CommandType.Text
即可或者使用参数(Dapper可以从对象中推断出它们)