Function imports for entity framework with odp.net managed driver

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 20:30:20

The implicit ref cursor config file format is different between Unmanaged ODP.NET and Managed ODP.NET. That might be part of your problem.

To save yourself from pulling your hair out, install the latest Oracle Developer Tools for Visual Studio (ODT) and use the new feature that automatically generates this config:

1) Install ODT 12.1 if you haven't already

2) Find the stored procedure in server explorer, right click it and run it, and enter input parameters.

3) For the output ref cursor that represents the return value for your Entity Function, choose "Add to Config" checkbox.

4) Then select either "Show Config" (and then cut and paste) or "Add to Config".

Here is a screenshot of what I am talking about:

http://i.imgur.com/t1BfmUP.gif

If this doesn't fix the problem, play around with that boolean mapping. I am not 100% sure of this as of this writing, but I remember hearing that support for booleans is another difference between managed and unmanaged ODP.NET. I'm sure it's buried in the release notes or doc somewhere.

Christian Shay

Oracle

Two things you would want to try which might potentially solve the issue:

  1. Ensure the case of the schema name, stored procedure name and the column names in the config are the same as that in the Oracle.
  2. Try mapping the native type to a more conformant provider type, like the first column COL1 - map an int32 providerType to the number(10,0) nativeDataType as enforced by your edmmapping, instead of the Decimal that you currently have. And so forth for the other columns (like remove the column lengths) until you do not see the error or get a different one.

I've got the same error and I think my problem is a providerType of DOUBLE or DECIMAL. But, I got one to work that has your 3 column types. Your problem is that a number(10,0) should be a providerType of "Int64".

Stored Procedure:

create or replace PROCEDURE "PROC_ESCC_FIELDS" (p_recordset OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p_recordset FOR
  SELECT COL1, COL2, COL3
     FROM MyTable;
END PROC_ESCC_FIELDS;

This works and returns the cursor:

<oracle.manageddataaccess.client>
  <version number="*">
    <implicitRefCursor>
      <storedProcedure schema="SERFIS" name="PROC_V_SERFIS_ESCC_FIELDS">
        <refCursor name="P_RECORDSET">
          <bindInfo mode="Output" />
            <metadata columnOrdinal="0" columnName="COL1" providerType="Int64" allowDBNull="false" nativeDataType="Number" />
            <metadata columnOrdinal="1" columnName="COL2" providerType="Date" allowDBNull="true" nativeDataType="Date" />
            <metadata columnOrdinal="2" columnName="COL3" providerType="Varchar2" allowDBNull="false" nativeDataType="Varchar2" />
        </refCursor>
      </storedProcedure>
    </implicitRefCursor>
  </version>
</oracle.manageddataaccess.client>

Click here for a list of the providerType and nativeDataType, etc. ENUMS:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!