EnityFrameworkCore 2.19.3 — oracle-tech

    Forum Stats

  • 3,715,657 Users
  • 2,242,821 Discussions
  • 7,845,481 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

EnityFrameworkCore 2.19.3

141e338b-cd68-4084-956a-dcaba5dff4be
edited August 2019 in ODP.NET

Hello,

I have been succesfully using EF for a while, but I ran into poblem with it.

Tables are getting scaffolded right, but till DateTime comes in place.

In table column is called

CREATED_DATE

in class: 

public DateTime? CreatedDate { get; set; }

in context

entity.Property(e => e.CreatedDate)

                    .HasColumnName("CREATED_DATE")

                    .HasColumnType("DATE")

                    .HasDefaultValueSql("NULL");

but when I call save changes I get this error:

Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00904: "t"."CreatedDate": invalid identifier

I have no idea if I can fix it, or why it generates the name column as CreatedDate, when it is right in context.

Any ideas please?

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,751 Employee
    edited August 2019

    I tried reproducing your issue with a CREATED_DATE column. I scaffolded and got the same class property CreatedDate. I then create a new entry and call SaveChanges(), which saves the info successfully. I don't encounter the ORA-00904.

    I use the new Oracle EF Core 2.19.30 against DB 12.2.

  • 141e338b-cd68-4084-956a-dcaba5dff4be
    edited August 2019

    I should note, that I am running against oracle 11.2 and I am still running into the same problem.

    Is there any more information, that I could provide?

    -- EDIT

    once I remove the created_date column and rescaffold, then everything woks just fine. If I add it again, then it doesnt work again. Tried to name the column CREATED, CREATEDDATE, CREATED_DATE, it seems like the column type date is the issue somehow.

    --

    I have tried creating the column with default value "sysdate" and without it. As NULL and NOT NULL.

    On every scenario there is also the same problem while reading.

    "ORA-00904: "t"."CreatedDate": invalid identifier",

    The problem is that it references "CreatedDate" which is in double qoutes totally wrong. Sadly I dont see into the method that creates the query.

    I am using it with .net core 2.2 web API.

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,751 Employee
    edited August 2019

    I just tried against an 11.2.0.4 DB. I attempt to insert a value in EF Core and it's successful.

    Do you want to publish the trace file? You can email it to us dotnet_us (at) oracle.com.

    Here's some instructions for setting up the trace:

    https://docs.oracle.com/en/database/oracle/oracle-data-access-components/19.3/odpnt/EFCoreClasses.html#GUID-D5D99935-D8A…

Sign In or Register to comment.