title: How to pass ConnectionString from appsettings.json file to class library project in dot net core 2.2
body: <p>I have two projects in my solution. One is an angular core 2.2 web application and other is a class library project which contains the domain models and the dbcontext.
  I want to pass the connection string to dbcontext so that i can create the database using the code first approach.
  this is my connection string</p>
  
  <pre><code>"ConnectionStrings": {
  "DataConnection": "Server=.;Database=Test;Trusted_Connection=True;MultipleActiveResultSets=true;Integrated Security=True;"
  </code></pre>
  
  <p>this the code in the ConfigureService Method</p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          services.AddDbContextPool&lt;TestContext&gt;(context =&gt; context.UseSqlServer(Configuration.GetConnectionString("DataConnection")));
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
      }
  </code></pre>
  
  <p>}</p>
  
  <p>And this is my DBContext</p>
  
  <pre><code>public class TestContext : DbContext
  {
   public CCPGV1Context(string connectionString):base(connectionString)
      {
  
      }
  
  protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
  
          base.OnModelCreating(modelBuilder);
      }
  }
  </code></pre>
  
  <p>I am new to code first approach as well as dot net core. Please guide me what should i do !</p>