title: Entity Framework throws error: Invalid object name
body: <p>I'm getting the following error with this sample I received, it looks correct by the manuals and docs I found.</p>
  
  <p>There are a lot of books I found here and all looks have the same pattern of code that looks like this one I received from a friend last week.</p>
  
  <p>I don't have much more detail about it but this form keep telling me its looks like mostly code then I need keep typing.  </p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException<br>
    HResult=0x80131904<br>
    Message=Invalid object name 'Persons'.<br>
    Source=Core .Net SqlClient Data Provider  </p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>using System;
  using System.Linq;
  using System.Threading.Tasks;
  using System.Collections.Generic;
  using Microsoft.EntityFrameworkCore;
  using System.ComponentModel.DataAnnotations;
  
  namespace ConsoleApp
  {
      public class BaseModel : DbContext
      {
          [Key]
          public int Id { get; set; }
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          {
              var strCnn = @"Data Source=localhost;Initial Catalog=TutorialDB;Integrated Security=True;Pooling=False";
              optionsBuilder.UseSqlServer(strCnn);
          }
      }
  }
  
  ----------------
  
  using System;
  using System.Linq;
  using System.Threading.Tasks;
  using System.Collections.Generic;
  using Microsoft.EntityFrameworkCore;
  using System.ComponentModel.DataAnnotations;
  
  namespace ConsoleApp.Model
  {
      public class Person : BaseModel
      {
          public DbSet&lt;Person&gt; Persons { get; set; }
  
          public Person() {}
  
          public Person(int _id, string _name) {
              this.Id = _id;
              this.Name = _name;
          }
  
          public string Name { get; set; }
      }
  }
  
  ----------------
  
  using System;
  using System.Linq;
  using System.Threading.Tasks;
  using System.Collections.Generic;
  
  namespace ConsoleApp
  {
      class Program
      {
          static void Main(string[] args)
          {
              using (Model.Person p = new Model.Person()) 
              {
                  p.Persons.Add(new Model.Person(01, "Name001"));
                  _ = p.SaveChanges();
              }
          }
      }   
  }
  </code></pre>