title: How do I set up a connection string into appsettings.json?
body: <p>How can I set up a connection string in my ASP.NET Core blazor WebAssembly Server component where I created the <code>appsettings.json</code>.</p>
  
  <pre><code>{
    "ConnectionStrings": {
      "SQLiteTestConnection": "Data Source=./TestDB.db",
    }
  }
  </code></pre>
  
  <p>Right now it looks like this but I cant create the database via <code>Update-Database</code>.</p>
  
  <p>Startup.cs:</p>
  
  <pre><code>...
   public void ConfigureServices(IServiceCollection services)
          {
              services.AddMvc();
              services.AddResponseCompression(opts =&gt;
              {
                  opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
                      new[] { "application/octet-stream" });
              });
  
              // Adding the DbContext references
              services.AddDbContext&lt;SQLiteTestDbContext&gt;(options =&gt;
                  options.UseSqlite("./TestDB.db"));
          }
  ...
  </code></pre>
  
  <p>my DbContext which is in use.
  This DbContext is stored in my Blazor Server component</p>
  
  <pre class="lang-cs prettyprint-override"><code>using DB_SQLite;
  using DB_SQLite.SQL_Models;
  using System.Collections.Generic;
  using Microsoft.EntityFrameworkCore;
  
  namespace BlazorWeb.Server.Data
  {
      public class SQLiteTestDbContext : DbContext
      {
          #region Constructor
  
          // Default parameterless Constructor 
          public SQLiteTestDbContext(DbContextOptions options)
              : base(options)
          {
  
          }
  
          #endregion
  
  
          public DbSet&lt;ObjectModel&gt; Objects { get; set; }
  
  
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
              =&gt; optionsBuilder.UseSqlite("Data Source=./TestDB.db");
  
  
          protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              #region Configure Object
  
  
              modelBuilder.Entity&lt;ObjectModel&gt;().HasData(LoadObjects());
              base.OnModelCreating(modelBuilder);
  
              #endregion
          }
  
          #region Seeding
  
          private List&lt;ObjectModel&gt; LoadObjects()
          {
              return new List&lt;ObjectModel&gt;
              {
                  new ObjectModel() { Id = 1, Name = "Schraube", TagName = "Werkzeug" ,PreviewImage = "null"},
                  new ObjectModel() { Id = 2, Name = "Gabelstapler", TagName = "Fahrzeug" ,PreviewImage = "null"},
                  new ObjectModel() { Id = 3, Name = "Zange", TagName = "Werkzeug" , PreviewImage = "null"},
                  new ObjectModel() { Id = 4, Name = "Sechskantschraube", TagName = "Werkzeug", PreviewImage = "null"},
              };
          }
  
          #endregion
      }
  }
  
  </code></pre>
  
  <p>Im also creating some fake data into the database in the DbContext Class.</p>