I've updated to EFCore 6.0 and now a lot of my queries are broken. The reason is that a lot of properties have the name which is a reserved word for our DB (I was not aware). Let's say:
builder.Entity<MyProperty>(b =>
{
b.ToTable("MY_TABLE", CoreDbProperties.DbSchema);
b.Property(x => x.Number).HasColumnName("C_NUMBER").IsRequired();
...
}
When Linq constructs the query - it names aliases after a property name and this breaks DB query.
To avoid nightmare with renaming tons of properties and doing regression testing afterwards, I suggest to make an alias customizable, like this:
builder.Entity<MyEntity>(b =>
{
b.ToTable("MY_TABLE", CoreDbProperties.DbSchema);
b.Property(x => x.Number).HasColumnName("C_NUMBER").HasAlias("MyNumber").IsRequired();
...
}
I've updated to EFCore 6.0 and now a lot of my queries are broken. The reason is that a lot of properties have the name which is a reserved word for our DB (I was not aware). Let's say:
When Linq constructs the query - it names aliases after a property name and this breaks DB query.
To avoid nightmare with renaming tons of properties and doing regression testing afterwards, I suggest to make an alias customizable, like this: