c# - 实体框架执行功能不起作用
问题描述
尝试通过实体框架调用 SQL 函数,无论我尝试哪种方法,我总是遇到同样的错误
The FunctionImport 'fn_SearchEmployer' could not be found in the container 'MyDatabase'.
我的代码是
public virtual ObjectResult<EmployerModel> EmployerSearch(string employerName, int userId)
{
var employerNameParam = new ObjectParameter("employerName", employerName);
var userIdParam = new ObjectParameter("userId", userId);
return ((IObjectContextAdapter) this).ObjectContext.ExecuteFunction<EmployerModel>("fn_SearchEmployer", employerNameParam, userIdParam);
}
任何想法将不胜感激!
解决方案
推荐阅读
- amazon-web-services - 为什么像 S3 (arn:aws:s3:::) 这样的 IAM 角色语句不适用于 SQS 等其他 AWS 资源?
- selenium - 如何通过“场景大纲示例”传递双引号
- flask - 我想比较数据库中的信息但出错
- xml - Indeed XML Feed 状态检查
- android - 如何观察 Moshi Kotlin 中的意外响应?
- flutter - Flutter InteractiveViewer 使图片高度
- python - Pytorch-lightning 奇怪的错误:实现的方法没有覆盖其父方法
- flutter - 如何在 Flutter 中将社交媒体链接/按钮添加到我的应用程序?
- python - 从 while True 打印值:在 Python 中
- c++ - 为什么 unsigned char 的默认初始化行为与其他数据类型不同?