PostgresException: 23503: update or delete on table violates foreign key constraint

0

When I want to insert to log table in OnActionExecuted (action filter) after endpoint executed I get below error:

 Npgsql.PostgresException (0x80004005): 23503: update or delete on table "Roles" violates foreign key constraint "FK_RoleId" on table "Users"

But I dont insert any of these table and a table has no foreign key column which I want to insert data. My insert comment is like this:

  ctx.LogResponses.Add(log);
  ctx.SaveChanges();

How can I solve this?

c#
postgresql
asp.net-core
entity-framework-core
action-filter
asked on Stack Overflow Feb 10, 2021 by John Lenon

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0