1

From my app I have opened a connection to Oracle with a Oracle.ManagedDataAccess.Client and used it for Entity Framework Core in this code:

optionsBuilder.UseOracle(connection)

My issue its when I call something like this:

txtStop_Trading_Message.Text = context.GlobalParam.ToList().First().Stop_Trading_Message;

I get an error:

Failed executing DbCommand (51ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT "g"."ID", "g"."DChange", "g"."Deleted", "g"."Is_Stop_Trading", "g"."Stop_Trading_Message", "g"."Uzi_ID"
FROM "PROSTREAM"."Global_param" "g"
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00942: table or view does not exist

But this code is working correctly:

txtStop_Trading_Message.Text = context.GlobalParam.FromSql("SELECT * FROM PROSTREAM.Global_param g FETCH FIRST 1 ROWS ONLY").ToList().First().Stop_Trading_Message;

So EF "autoselect" of the .ToList() function does not work, because in select its " char, any idea why?

When I take this select and remove the chars ", select is ok and working with .FromSql() function, also in SQL Developer, etc...

Thanks you...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Resolved by this: https://stackoverflow.com/questions/9729750/how-to-configure-dbcontext-to-work-with-oracle-odp-net-and-ef-codefirst – Stanislav Matzke Oct 09 '19 at 12:17

0 Answers0