title: Sqlite connection string in AppData folder. Entity Framework Core
body: <p>I'm making an application which use the sqlite as localdb.</p>
  
  <p>I want to save the databse within the appdata file of the user.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>using Microsoft.EntityFrameworkCore;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace cctv_tech.Models
  {
      class DatabaseContext : DbContext
      {
          public DbSet&lt;Setting&gt; Settings { get; set; }
  
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          {
              optionsBuilder.UseSqlite("Data Source=mydb.db;"); 
              // this is working, but database file is within the debug folder
  
              optionsBuilder.UseSqlite("Data Source=c:\\mydb.db;");
              // this output me an error which the database cannot be open,
              // and when checked there is no such file
          }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Rrl86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rrl86.png" alt="SQLite Error 14"></a></p>
  
  <p>Hope someone can help. Thanks a lot.</p>