C#C
C#6mo ago
enrico11011

EF Core throws `DbUpdateException - duplicate primary key` on an empty table

I need some help debugging a DbUpdateException (Inner Exception 1: MySqlException: Duplicate entry '1' for key 'PRIMARY') that's getting thrown when I try to save with EF Core.

The UI piece responsible for creating an instance of the new model is here:

                <StackPanel Grid.Row="0" Grid.Column="2">
                    <TextBox Watermark="From" Text="{Binding NewTransferForm.From}"/>
                    <TextBox Watermark="To" Text="{Binding NewTransferForm.To}"/>
                    <Button Grid.Row="0" Grid.Column="2"
                            Content="Create New Transfer Form"
                            Command="{Binding AddNewTransferFormCommand}"/>
                </StackPanel>
Was this page helpful?