无法使用.Net EF(2.2)核心存储库模式访问oracle存储的proc [英] Unable to hit oracle stored proc using .Net EF(2.2) Core repository pattern
本文介绍了无法使用.Net EF(2.2)核心存储库模式访问oracle存储的proc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ORA-00900:无效的SQL语句
ORA-00900: invalid SQL statement
这是我尝试从我的API中访问存储过程(在Oracle中)时遇到的错误.
This is the error i get when i am trying to hit a stored procedure(in Oracle) from my API.
我在实体框架中使用存储库模式.(EF Core 2.2)
I am using Repository pattern with Entity framework.(EF Core 2.2)
这是我的电话,
return FetchWithStoredProcedure("PROC_GETMYPROC",
new OracleParameter("PARAM1", OracleDbType.Int32, ParameterDirection.Input) { Value = PageNo },
new OracleParameter("PARAM2", OracleDbType.Int32,ParameterDirection.Input) { Value = PageSize },
new OracleParameter("PARAM3", OracleDbType.Varchar2, 30, ParameterDirection.Input) { Value = SearchTerm },
new OracleParameter("PARAM4", OracleDbType.Int32, ParameterDirection.InputOutput) { Value = TotalRows },
new OracleParameter("PARAM5",OracleDbType.RefCursor, ParameterDirection.Output)
).ToList();
这是我的FetchWithStoreProcedure方法
This is my FetchWithStoreProcedure method
public IEnumerable<T> FetchWithStoredProcedure(string query, params object[] parameters)
{
return _entities.Set<T>().FromSql(query, parameters);
}
这是抛出的异常.
推荐答案
请尝试如下操作
return FetchWithStoredProcedure("BEGIN PROC_GETMYPROC(@PARAM1,@PARAM2,@PARAM3
,@PARAM4,@PARAM5); END",
这篇关于无法使用.Net EF(2.2)核心存储库模式访问oracle存储的proc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文