C# Entity Framework Core - wrong .ToList() "autoselect" to Oracle database


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:


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

asked on Stack Overflow Oct 7, 2019 by Stanislav Matzke • edited Oct 7, 2019 by marc_s

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0