I'm wondering how to map a View created in Oracle Database 11G with Fluent-API.
Here is an excerpt from the view with alias:
tran.id_transporte AS "ID Navio",
tran.ds_nome_transporte AS "Navio",
pemb.id_porto AS "ID Porto Embarque",
pemb.ds_porto AS "Porto Embarque",
temb.id_terminal AS "ID Terminal",
In the mapping I did as follows:
public VWProgramacaoEmbarque_Mapping()
{
this.HasKey(t => t.IdTerminal);
this.ToTable("VW_PROGRAMACAO");
this.Property(t => t.IdNavio).HasColumnName("ID_TRANSPORTE");
this.Property(t => t.Navio).HasColumnName("DS_NOME_TRANSPORTE");
this.Property(t => t.IdPortoEmbarque).HasColumnName("ID_PORTO");
this.Property(t => t.PortoEmbarque).HasColumnName("DS_PORTO");
this.Property(t => t.IdTerminal).HasColumnName("ID_TERMINAL");
}
In Oracle I can query an aliased column.
select distinct("ID Navio") from vw_programacao;
In my application I'm performing the query as follows:
var idNavios = Context.VWProgramacao.Select(e => e.IdNavio).Distinct();
But it generates the following error:
{"ORA-00904: \" Extent1 \ ". \" TRAY_ID ": Invalid identifier"}
I think it's because of my mapping that is wrong or maybe it's because of the alias of my view.
Any idea what it might be? Where am I going wrong?