EF Issue when having multiple Foreign keys to the same table

I have a table that has two foreign keys to the same reference table.

When running the blazor project, I am getting this issue:

dotnet: warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: The number of properties specified for the foreign key {'clientepadreid', 'clientehijoid'} on entity type 'Clientesubcliente' does not match the number of properties in the principal key {'clienteid'} on entity type 'Cliente'.

Ok, I checked the FwContext.cs

Then I saw this,

blazorEFError1

To temporary fix it, I put the FwContext.cs on the code generation ignore list,
and make the following adjustment

          .HasForeignKey(i => new { i.clientepadreid })
          .HasForeignKey(i => new { i.clientehijoid })

Now it works.

Please fix it as soon as possible, so no workaround is needed with the code generation ignore.

Thanks and keep it up the great support!

1 Like

Hi @Jose_Carrillo,

Please send us your database schema in order to check what's going on.