C#C
C#15mo ago
lllggghhhaaa

✅ Problem connecting entities on efcore

I'm new with blazor and efcore and i'm in trouble to connect 2 relation

Error: ---> Npgsql.PostgresException (0x80004005): 23505: Duplicate key value violates unique constraint "PK_Blocks"

Method:
    public async Task AddPaletteAsync(Database.Palette palette, ApplicationUser user)
    {
        await using var context = await dbContextFactory.CreateDbContextAsync();
        
        palette.UserId = user.Id;
        context.Palettes.Add(palette);
        await context.SaveChangesAsync();
    }
Was this page helpful?