加入收藏 | 设为首页 | 会员中心 | 我要投稿 拼字网 - 核心网 (https://www.hexinwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

oracle – 在实体框架中映射SYS_REFCURSOR

发布时间:2021-05-22 18:47:04 所属栏目:站长百科 来源:网络整理
导读:我试图通过Entity Framework访问Oracle 11g上的存储过程.我可以访问返回标量的存储过程,并返回正确的值.但是,当使用SYS_REFCURSOR返回结果集时,在函数导入时未检测到OUT参数. 我的存储过程如下 create or replace PROCEDURE "GetAllClientNames" ( "ID" IN N

我试图通过Entity Framework访问Oracle 11g上的存储过程.我可以访问返回标量的存储过程,并返回正确的值.但是,当使用SYS_REFCURSOR返回结果集时,在函数导入时未检测到OUT参数.

我的存储过程如下

create or replace PROCEDURE "GetAllClientNames" (
  "ID" IN NUMBER,"SAL" IN NUMBER,"EMP_CURSOR" OUT SYS_REFCURSOR) IS

BEGIN 


    OPEN EMP_CURSOR FOR SELECT FIRSTNAME FROM CLIENTS;

END;

但是在更新实体并执行函数导入时,导入的函数中未检测到SYS_REFCURSOR OUT参数以检索结果集.

请帮我解决这个问题.没有OUT参数我无法访问存储过程检索的结果集

现在oracle数据提供程序允许这种操作没有太多的喧嚣.它在这里过于精心回答.添加了快速阅读.请按照以下链接获取详细信息.

ODP.NET 11g Release 2 (11.2.0.3.0),and higher,enables applications
to run stored procedures with REF CURSOR parameters without using
explicit binding for these parameters in the .NET code.

For a read-only result set,such as a REF CURSOR using
OracleDataReader,REF CURSOR schema information is retrieved
automatically.

For some scenarios,such as when updateable REF CURSORs or Entity
Framework is used,developers need to define the REF CURSOR schema
information so that the application can bind the implicit REF CURSOR.
Entity Framework applications use implicit REF CURSOR binding to
instantiate complex types from REF CURSOR data. Applications must
specify REF CURSOR bind and metadata information in the app.config,
web.config,or machine.config .NET configuration file.

The attributes supplied in the .NET configuration file are also used
when the application requests for schema information from the
OracleDataReader object that represents a REF CURSOR. This means that
for REF CURSORs that are created using a SELECT from a single table,
the application can update that table through the use of
OracleDataAdapter and OracleCommandBuilder.

When using the Entity Framework,function imports can return an
implicitly-bound REF CURSOR. The REF CURSOR can be returned as a
collection of complex types or entity types. To return a complex type
collection,the .NET configuration file needs to define the REF CURSOR
bind and metadata information. To return an entity type collection,
only the bind information needs to be defined in the .NET
configuration file.

查找完整信息here

(编辑:拼字网 - 核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!