【发布时间】:2022-07-06 13:13:32
【问题描述】:
我在这段代码中调用了一个存储过程,该存储过程将根据其执行返回 1 或 0。
public async Task<int> CreateData(int id, string name)
{
return await _dbContext.Database.ExecuteSqlInterpolated($"execute spname {id}, {name}");
}
运行这段代码,我得到这个错误:
int 不包含 GetAwaiter 的定义
我在 Google 上检查了解决方案,它说我需要在存储过程调用结束时使用 .ToListAsync()。但是我的存储过程没有返回任何列表。
有人可以帮忙吗?
提前致谢。
【问题讨论】:
标签: c# asynchronous .net-core entity-framework-core asp.net-core-webapi