Failing to load index include properties
I'm using Linqpad 6 with the PostgreSQL provider (version 5.0.7 Npgsql) and things are working great. Recently I started having an issue where I couldn't load the database connection in queries anymore with the message of
Error: Include property 'SomeModel.some_prop' not found.
I was at a loss for a bit on what to do about it when I realized I was only getting this message on some new model properties I has added recently. These were configured as included properties on indexes. These were defined on the model using EF Core like so:
builder.Entity<SomeModel>() .HasIndex(af => af.SomeColumn) .IncludeProperties(af => af.SomeProp);
Once I dropped these indexes the db contexts loaded correctly on the queries and all works well.
Just another thing to take note of is that while the c# models follow the naming convention of Pascal Case, we map the database objects to follow the snake case naming convention that PostgreSQL follows.