10G .net core 3.1 beta | linq query exception when relating classes
See original GitHub issueIt appears to exclude the dot between BookingBlock alias class and the property.
I’ve tweaked my classes and now I get a 00936 Missing expression. Update: I’ve added the one to many relationship in dbcontext and added the CustomerGroup as a property to BookingBlock. I get the same ora 00936.
The query I’m looking to mimic is
select pbb.RPTNG_FLOW_PATH_ID, pcg.CUST_GROUP_IDFTN from PDF_BOOKING_BLOCK pbb, PDF_CUST_GROUP pcg where 1 = 1 and pbb.CUST_GROUP_IDFTN = pcg.CUST_GROUP_IDFTN and pbb.RPTNG_FLOW_PATH_ID = 2 and pbb.CUST_GROUP_IDFTN = 275
DBContext ` public DbSet<BookingLimit> BookingLimits { get; set; } public DbSet<BookingBlock> BookingBlocks { get; set; } public DbSet<CustomerGroup> CustomerGroups { get; set; } public DbSet<FlowPath> FlowPaths { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { //leaving this for now to use for direct db integration/validation in unit test if (!optionsBuilder.IsConfigured) { optionsBuilder .UseLoggerFactory(ConsoleLoggerFactory) .UseOracle(“Data Source = xxx”); } }
public static readonly ILoggerFactory ConsoleLoggerFactory =
LoggerFactory.Create(builder =>
{
builder.AddFilter((category, level) =>
category == DbLoggerCategory.Database.Command.Name && level == LogLevel.Information).AddConsole();
});
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<BookingBlock>().ToTable("PDF_BOOKING_BLOCK");
modelBuilder.Entity<FlowPath>().ToTable("PDF_FLOW_PATH");
modelBuilder.Entity<CustomerGroup>().ToTable("PDF_CUST_GROUP");
//tables w/ composite keys
modelBuilder.Entity<BookingBlock>()
.HasKey(pk => new { pk.RPTNG_FLOW_PATH_ID, pk.CUST_GROUP_IDFTN });
//one to many
modelBuilder.Entity<CustomerGroup>().HasMany(cg => cg.BookingBlocks).WithOne(bb => bb.CustomerGroup);
`
Classes
` public class CustomerGroup { public CustomerGroup() { BookingBlocks = new List<BookingBlock>(); }
[Key]
public int CUST_GROUP_IDFTN { get; set; }
public string CUST_GROUP_NAME { get; set; }
public string CUST_GROUP_DESC { get; set; }
public string ENABLED_INDIC { get; set; }
public string LAST_CHNGD_IDFTN { get; set; }
public DateTime DATE_CRTD { get; set; }
public DateTime DATE_LAST_CHNGD { get; set; }
public List<BookingBlock> BookingBlocks { get; set; }
} `
` public class BookingBlock {
public int RPTNG_FLOW_PATH_ID { get; set; }
public int CUST_GROUP_IDFTN { get; set; }
public int BLOCK_MIN_LEAD_TIME { get; set; }
public int BLOCK_BKNG_WEEKS { get; set; }
public string ENABLED_INDIC { get; set; }
public int SORT_SEQ { get; set; }
public string LAST_CHNGD_IDFTN { get; set; }
public DateTime DATE_CRTD { get; set; }
public DateTime DATE_LAST_CHNGD { get; set; }
public FlowPath FlowPath { get; set; }
public CustomerGroup CustomerGroup { get; set; } } `
on 06/02 I got this error. Oracle.ManagedDataAccess.Client.OracleException: ORA-00904: “p”.“BookingBlockCUST_GROUP_IDFTN”: invalid identifier
After some class adjustments I now get the 00936
using (var context = new DaleContext()) { var customer = context.CustomerGroups.Where(cg => cg.CUST_GROUP_IDFTN == 275 && cg.BookingBlocks.FirstOrDefault().RPTNG_FLOW_PATH_ID == 2).ToList(); Assert.AreEqual(1, customer.Count); }
Test method Oracle.ManagedDataAccess.Client.OracleException: ORA-00936: missing expression
I have no issues running this the filter w/ just the cust identifer: ` using (var context = new DaleContext()) { var customer = context.CustomerGroups.Where(cg => cg.CUST_GROUP_IDFTN == 275).ToList(); customer.ForEach(c => Console.WriteLine(c.CUST_GROUP_NAME));
Assert.AreEqual(1, customer.Count);
}
`
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
@JQ-IOWA My team at Oracle hasn’t tested Oracle 10.2 DBs with Oracle EF Core 3.1 since it’s not a supported combination. It’s not totally unexpected that some straightforward use cases will fail.
Yes, please re-open if it fails with DB 11.2.0.4 or higher.