title: Application break accessing dbcontext, Asp .net core web api 2.0 with entity framework core 2.0 database first approach
body: <p>I have developed asp .net core wep api 2.0 application with EntityFrameworkCore.SqlServer 2.0. It is developed using database first approach. When trying to access entities using dbcontext application is going to break mode. I cannot find the reason for application state to going break state. Please help to resolve this. </p>
  
  <p>Below is the OnConfiguring method in DBContext class.</p>
  
  <pre><code>    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          if (!optionsBuilder.IsConfigured)
          {
              optionsBuilder.UseSqlServer(@"Server=(local);Database=VotingAppDB;User ID=sa;Password=123;");
          }
      }
  </code></pre>
  
  <p>Below code block used to access dbcontext entities in controller</p>
  
  <pre><code>    // GET api/values
      [HttpGet]
      public IEnumerable&lt;string&gt; Get()
      {
          VotingAppDBContext context = new VotingAppDBContext();
          var questions = context.Questions.ToList();
          return new string[] { "value1", "value2" };
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bLh5x.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bLh5x.png" alt="Installed packages"></a></p>
  
  <p><a href="https://i.stack.imgur.com/rCbgk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rCbgk.png" alt="Application error"></a></p>