1 Reply Latest reply on Oct 2, 2019 6:51 PM by Molonator69

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

    Molonator69

      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.