Calling a pipelined function and populating a complex type
Posted: Wed 12 Feb 2020 12:06
Hi,
I'm needing to populate an entity from a pipelined function and am getting an OracleException: ORA-01036: illegal variable name/number . This is *most likely* because of the return parameter type
My code is below
I have tried overriding OnModelCreating without success
As an alternative to OnModelCreating I've also tried the below within my Dbcontext
...but I get the same oracle exception as above.
Is there something I'm missing that's causing the output to not be recognised? Is there an oracle return type which I could be using?
I'm needing to populate an entity from a pipelined function and am getting an OracleException: ORA-01036: illegal variable name/number . This is *most likely* because of the return parameter type
My code is below
Code: Select all
public async Task<List<OutstandingTrade>> GetOutstandingTradesAsync(string instCode)
{
var x = await this.Database.SqlQuery<OutstandingTrade>("SELECT * FROM TABLE( f_outstanding_orders(p_inst_code)",
new OracleParameter("p_inst_code", OracleDbType.VarChar, instCode,ParameterDirection.Input)).ToListAsync();
return x;
}
Code: Select all
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ComplexType<OutstandingTrade>();
modelBuilder.ComplexType<OutstandingTrade>().Property(x => x.ShortName).HasColumnName("SHORT_NAME");
modelBuilder.ComplexType<OutstandingTrade>().Property(x => x.PfoCode).HasColumnName("PFO_CODE");
modelBuilder.ComplexType<OutstandingTrade>().Property(x => x.IconCode).HasColumnName("ICON_CODE");
...etc etc
}
Code: Select all
public virtual DbSet<OutstandingTrade> OutstandingTrades { get; set; }
Is there something I'm missing that's causing the output to not be recognised? Is there an oracle return type which I could be using?