-
Notifications
You must be signed in to change notification settings - Fork 60
"SQLite Error 1: 'no such column" exception with EFc5 #288
Comments
Hi, it seems that this is an old issue: |
Hello, My Patient entity has a 1to1 relation to an entity BiometricParameterSet. The corresponding foreignkey/column in BiometricParameterSets table is called "Patient.BiometricParameterSet_PatientId" (as usual) but now the code generated in OnModelCreating() contains line like (using the option TableUnderscoreColumn):
as the column "Patient_BiometricParameterSet_PatientId" does not exists this generates exceptions during execution. The genrated code should be:
with the above code, no exeption. Another remark, with EF designer 2.x targetting EFc 3.x, the generated code is:
which do the same thing. |
Your best bet would be to add the code generation template to your project and edit it to emit the code you're after. This particular bit is emitted from EFCoreModelGenerator.ttinclude or EFCore5ModelGenerator.ttinclude (depending on whether you're targeting EFCore5 or not). There's more info on this process at https://msawczyn.github.io/EFDesigner/Customizing.html#replacing-the-t4-templates |
Hi, regards |
Hi,
using EFc5 with EF Designer 3.0.6, i noticed incoherencies in the generated code during call to HasForeignKey().
For instance, if a entity Profession has an identity property ProfessionId, and if a entity Patient has a navigation property Profession to Profession entity, the code generated in OnModelCreating() contains line like:
modelBuilder. ... .HasForeignKey("ProfessionProfessionId");
but the corresponding column in the database table Patient is named 'Profession_ProfessionId'.
With previous versions (EFc 3.1 or EF Designer ??) the code generated in OnModelCreating() contains line like:
modelBuilder. ... .HasForeignKey("Profession_ProfessionId");
Consequently, all queries implying Patient and its navigation property Profession, fail by fire an exception telling "SQLite Error 1: 'no such column: p.ProfessionProfessionId'".
Any idea?
regards
The text was updated successfully, but these errors were encountered: