How to ignore Foreign Key Constraints in Entity Framework Core SQLite database?
<p>Foreign Key constraint failed use SQLite with Entity Framework Core</p>

<p>I have relations in table</p>

<pre><code>[Table("organizations")]
public class Organizations
{
    [Column("id")]
    public int Id { get; set; }

    [Column("parent_id")]
    [ForeignKey("id")]
    public int? ParentId { get; set; }

    [Column("person_id")]
    public int? PersonId { get; set; }
 }


public DbSet&lt;Organizations&gt; Organizations { get; set; }

using (var db = new SQLiteDbContext($"Filename={dbPath};"))
{
    db.Database.ExecuteSqlCommand("PRAGMA foreign_keys=OFF;");
    db.Database.ExecuteSqlCommand("PRAGMA ignore_check_constraints=true;");
    db.Organizations.AddRange(organizationsResult.Rows);
}
</code></pre>

<p>I get an error from the Sqlite database:</p>

<blockquote>
  <p>{"SQLite Error 19: 'FOREIGN KEY constraint failed'"}</p>
</blockquote>