Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle ODP.NET Entity Framework returning empty results

I have been trying to retrieve data from an Oracle 12g database using the following:

    using (MyDbContext db = new MyDbContext())
    {
        var t = db.MyTable.ToList();
    }

The underlying SQL is:

SELECT 
"Extent1"."TOKEN" AS "TOKEN", 
"Extent1"."FINGERPRINT" AS "FINGERPRINT", 
"Extent1"."EXPIRES" AS "EXPIRES", 
"Extent1"."ISSUED" AS "ISSUED"
FROM "MYSCHEMA"."MYTABLE" "Extent1

I run the SQL above within Oracle SQL Developer and it works just fine.

There is only 1 record in the MYSCHEMA.MYTABLE table but when calling the .ToList() I get zero results.

Am I missing some setting with Oracle's Entity Framework?

Using from nuget:

  • Oracle 11g (11.2.0.1.0 - 64bit)
  • Official Oracle ODP.NET, Managed Entity Framework Driver (12.1.021)
  • Microsoft Entity Framework (6.1.3)
like image 978
FrankO Avatar asked Mar 25 '15 17:03

FrankO


Video Answer


1 Answers

Apparently when I inserted the new record into the MYSCHEMA.MYTABLE table I forgot to COMMIT it to the database.

Therefore, the Oracle SQL Developer tool was able to show me that the record was en route to becoming a record but until I committed it no other external process would be able to retrieve the record.

Lesson learned. Maybe this answer will be helpful to others.

like image 165
FrankO Avatar answered Oct 02 '22 23:10

FrankO