1

I recently switched from ODP Unmanaged to ODP Managed (in conjunction with Entity Framework). The Unmanaged drivers were working fine after adding the necessary information in the web.config section. I could add the stored procedures and generate the complex types using the Function Import - Get Column information (I'm trying to import a stored procedure with an OUT refcursor parameter). After the switch the config section was updated to reflect the new format and everything works at runtime (so the format is correct).

However when I try to generate the complex types again (or add a new Function Import) I just get a System.notSupportedException Message: The specified type is not supported by this selector) Without any indication which type/selector it is (obviously)...

Google has turned up nothing and the thread on the Oracle Forums has gathered no response as well.

Versions: ODP.Net (ODAC) : v12.1 (Production release; DLL v4.121.1.0) EF v5 .NET v4.5 Config file (trimmed a bit):

<configSections>
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess"/>
</configSections>
<oracle.manageddataaccess.client>
    <version number="*">
        <edmMappings>
            <edmMapping dataType="number">
                <add name="bool" precision="1"/>
                <add name="byte" precision="2" />
                <add name="int16" precision="5" />
                <add name="int32" precision="10" />
                <add name="int64" precision="38" />
            </edmMapping>
        </edmMappings>
        <implicitRefCursor>
            <storedProcedure schema="ECOM" name="SHP_API_ORDERS.CREATE_ORDER">
                <refCursor name="O_RS">
                    <bindInfo mode="Output"/>
                    <metadata columnOrdinal="0" columnName="COL1" nativeDataType="Number" providerType="Decimal" allowDBNull="false" numericPrecision="10" numericScale="0" />
                    <metadata columnOrdinal="1" columnName="COL2" nativeDataType="Date" providerType="Date" allowDBNull="true" />
                    <metadata columnOrdinal="2" columnName="COL3" nativeDataType="Varchar2" providerType="Varchar2" allowDBNull="false" columnSize="10" />
                </refCursor>
            </storedProcedure>
        </implicitRefCursor>
    </version>
</oracle.manageddataaccess.client>
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<system.data>
    <DbProviderFactories>
        <remove invariant="Oracle.ManagedDataAccess.Client" />
        <add name="ODP.NET, Managed Driver"
             invariant="Oracle.ManagedDataAccess.Client"
             description="Oracle Data Provider for .NET, Managed Driver"
             type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
</system.data>
4

3 回答 3

4

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

于 2014-02-06T03:37:01.887 回答
0

您想尝试的两件事可能会解决问题:

  1. 确保配置中的模式名、存储过程名和列名的大小写与Oracle中的相同。
  2. 尝试将本机类型映射到更符合标准的提供程序类型,例如第一列 COL1 - 将int32 providerType映射到由您的 number(10,0) edmmapping强制执行的 nativeDataType,而不是您当前拥有的 Decimal。以此类推其他列(如删除列长度),直到您看不到错误或得到不同的错误。
于 2014-02-04T11:12:55.333 回答
0

我遇到了同样的错误,我认为我的问题是 DOUBLE 或 DECIMAL 的 providerType。但是,我有一个工作有你的 3 列类型。您的问题是数字(10,0)应该是“Int64”的providerType。

存储过程:

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;

这有效并返回光标:

<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>

单击此处获取 providerType 和 nativeDataType 等的列表。 ENUMS:

于 2017-02-17T21:52:29.563 回答