3

I have and web api and I use entity framework but for procedure I am calling procedure like code below

    public List<PDS_SPR_ATAMA> GetListAtama()
    {
        List<PDS_SPR_ATAMA> result = new List<PDS_SPR_ATAMA>();
        try
        {
            var param4 = new OracleParameter("PRC", OracleDbType.Cursor, ParameterDirection.Output);
            result = _db_dev.Database.SqlQuery<PDS_SPR_ATAMA>(
            "BEGIN BMS.PA_HR_PORTAL.PR_GET_SPR_ATAMALAR(:V_PRC); end;", param4).ToList();
            return result;
        }
        catch (Exception ex)
        {
            return result;
        }
    }

as library I use

using Devart.Data.Oracle;

I take error below

The Parameters collection only accepts Devart.Data.Oracle.OracleParameter type objects

How can I solve problem. Thanks in advance

mr. pc_coder
  • 16,412
  • 3
  • 32
  • 54
  • From the look of it it seems your param4 is not Devart.Data.Oracle.OracleParameter, but for example System.Data.OracleClient.OracleParameter (same name, different namespace) – Evk Oct 25 '20 at 16:18
  • When I downgrade devart version to 5.0.1772.0 it worked. I need to work it for newer versions too. @Evk – mr. pc_coder Oct 25 '20 at 16:23
  • 2
    Did you update all dlls/nuget packages to that new version? Devart.Data.Oracle, Devart.Data.Oracle.EFCore and so on? – Evk Oct 25 '20 at 16:33

2 Answers2

1

Please use Devart.Data.Oracle.OracleParameter instead of OracleParameter to make sure you are using OracleParameter from the Devart.Data.Oracle namespace.

Devart
  • 119,203
  • 23
  • 166
  • 186
0

You should use _db_dev.Database.ExecuteSqlCommand. Please follow the below link. I think it will help you.

Calling Oracle stored procedure using Entity Framework with output parameter?