Search code examples
.netoracle-databaseentity-frameworkodp.netsys-refcursor

What's wrong with my app.config configuration for ODP.Net and REF_CURSORS?


I've been struggling for a while with this, im following this guide:

This are the steps I have taken so far:

  1. Create new console project
  2. Add new EntityModel
  3. Import "Test" Stored Procedure into Entity Model, sp looks like this:

    CREATE OR REPLACE PROCEDURE SCHEMA.TEST(P_SALIDA OUT NUMBER,
                                P_CURSOR1 OUT sys_refcursor,
                                P_CURSOR2 OUT sys_refcursor) IS
    BEGIN
       P_SALIDA := 15;
       OPEN P_CURSOR1 FOR
       SELECT 125.72 "DECIMAL", 150 "INTEGER", 'JUST PASSING BY' "TEXT" FROM DUAL;
    
       OPEN P_CURSOR2 FOR
       SELECT 'JUST SOME TEXT' "TEXT" FROM DUAL;
    
    END TEST;
    /
    
  4. Add this to app.config:
<add name="SCHEMA.TEST.RefCursor.P_CURSOR1" value="implicitRefCursor bindinfo='mode=Output'" />  
<add name="SCHEMA.TEST.RefCursorMetaData.P_CURSOR1.Column.0" value="implicitRefCursor metadata='ColumnName=DECIMAL;NATIVEDATATYPE=Number;ProviderType=Decimal'" />  
<add name="SCHEMA.TEST.RefCursorMetaData.P_CURSOR1.Column.1" value="implicitRefCursor metadata='ColumnName=INTEGER;NATIVEDATATYPE=Number;ProviderType=Int32'" />  
<add name="SCHEMA.TEST.RefCursorMetaData.P_CURSOR1.Column.2" value="implicitRefCursor metadata='ColumnName=TEXT;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />  
<add name="SCHEMA.TEST.RefCursor.P_CURSOR2" value="implicitRefCursor bindinfo='mode=Output'" />
<add name="SCHEMA.TEST.RefCursorMetaData.P_CURSOR2.Column.0" value="implicitRefCursor metadata='ColumnName=TEXT;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />

Then I try to import function from the Entity Model I created before but when I click obtain column information after selecting complex type nothing happens, it doesn't show the cursor like the obe tutorial.

Any help would be appreciated.

Thanks

EDIT:

So I tried again today, and it's behaving differently this time. Now when I click the Obtain Column Information button in the import function dialog, the dialog just closes and nothing else happens.


Solution

  • So, this may sound embarrassing, but it was actually a problem with Visual Studio, I closed the IDE and opened it again, and it started working.

    Still I don't recommend this method to anyone, its too much work just to import a function.