Query Type EF .Net Core 2.2 Don´t work mapping Views( ORA-00940) — oracle-tech

    Forum Stats

  • 3,715,999 Users
  • 2,242,927 Discussions
  • 7,845,731 Comments

Discussions

Howdy, Stranger!

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

Query Type EF .Net Core 2.2 Don´t work mapping Views( ORA-00940)

Molonator69
Molonator69 Member Posts: 7
edited October 2019 in ODP.NET

I am trying to map a view and it is impossible, it always gives the error ORA-00904.

I am following what the documentation related to Query Type indicates. That is to say:

1.- I create the class

    public partial class VDato_1

    {

        public int Level0 {get; set; }

        public string Denomination {get; set; }

    }

2.- Include in the dbContext the Query.

    public partial class C21Context: DbContext

    {

        ....

         public virtual DbQuery <VDato_1> VDato_1 {get; set; }

         protected override void OnModelCreating (ModelBuilder modelBuilder)

        {

           modelBuilder.Query <VDato_1> () .ToView ("V_DATO_1");

            ....

       }

  }

I have many tables in the same scheme that I access without problems, it is only with the views where I have the problem.

3.- call:

using (C21Context mc = new C21Context ()) {

        var elem1 = mc.VDato_1.ToList ();

}

And that's where I get the error ORA-00940.

Oracle.ManagedDataAccess.Client.OracleException: 'ORA-00904: "v". "Level0": invalid identifier'

The View (More simple can not be)

  CREATE OR REPLACE FORCE VIEW "DB1". "V_DATO_1" ("LEVEL0", "DENOMINACION") AS

  SELECT

        dato.level0,

        dato denominacion

   FROM

       db1.dato;

I´m using:

.Net Core 2.2

Oracle.EntityFrameworkCore 2.19.30

WIth tables Oks, but with Views I don´t undertand the problem.

thans, sorry my English.

Best Answer

  • Molonator69
    Molonator69 Member Posts: 7
    edited October 2019 Accepted Answer

    Resolved!!

    The  problem are that in the create view, the camps are in UPPER!.

    Solution is:

        public partial class VDato_1

        {

            public int LEVEL0{get; set; }

            public string DENOMINACION {get; set; }

        }

    Agg.

Answers

  • Molonator69
    Molonator69 Member Posts: 7
    edited October 2019 Accepted Answer

    Resolved!!

    The  problem are that in the create view, the camps are in UPPER!.

    Solution is:

        public partial class VDato_1

        {

            public int LEVEL0{get; set; }

            public string DENOMINACION {get; set; }

        }

    Agg.

Sign In or Register to comment.