title: How to properly connect database with MVC web project, getting Value cannot be null. Parameter name: entitySet'
body: <p>When I add something to the DbSet I get the error I described, I imported everything I need plus some things I read on stackoverflow, when I make a console app I connect it without a problem but for some reason, it doesn't work with web project.</p>
  
  <p>This is part of my Web.config file I provided the rest of the classes below</p>
  
  <p></p>
  
  <pre><code>&lt;add name="MyDBContext" providerName="System.Data.SqlClient" connectionString="Server=Batonja-PC; Database=ProjekatBaza; user=sa;password=stoka123"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>public class Korisnik {</p>
  
  <pre><code>public Korisnik(){
  
  }
  
  public override bool Equals(object obj)
  {
      Korisnik gost = (Korisnik)obj;
      if(Username == gost.Username)
      {
          return true;
      }
      return false;
  }
  
  public override int GetHashCode()
  {
      return Username.GetHashCode();
  }
  
  public override string ToString()
  {
      return Ime + " " + Prezime + " " + Pol.ToString() + " " + Username + " " + Password;
  
  }
  
  
  
  public Korisnik(string ime, string password, Pol? pol, string prezime, string username)
  {
      Ime = ime;
      Password = password;
      Pol = pol;
      Prezime = prezime;
      Username = username;
      Uloga = Roles.Domacin;
  }
  
  
  
  public string Ime { get; set; }
  
  public string Password { get; set; }
  
  public Pol? Pol { get; set; }
  
  public string Prezime { get; set; }
  
  public Roles? Uloga { get; set; }
  
  [Key]
  public string Username { get; set; }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>public class MyDBContext : DbContext
  {
      public DbSet&lt;Domacin&gt; Domacini { get; set; }
      public DbSet&lt;Gost&gt; Gosti { get; set; }
      public DbSet&lt;Administrator&gt; Administratori { get; set; }
      public DbSet&lt;Rezervacija&gt; Rezervacije { get; set; }
      public DbSet&lt;Komentar&gt; Komentari { get; set; }
      public DbSet&lt;Apartman&gt; Apartmani { get; set; }
      public DbSet&lt;Korisnik&gt; Korisnici { get; set; }
  
      public MyDBContext(): base("MyDBContext")
      {
  
      }
  
  
  }
  </code></pre>
  
  <p>public ActionResult Index()
          {</p>
  
  <pre><code>        UcitajAdmine(@"D:\FAKS\WEB\Projekat\Projekat\Projekat\Administratori.txt");
  
          using (var context = new MyDBContext())
          {
              Korisnik korisnik = new Korisnik("Mile","stokan",Pol.Muski,"MIlic","Milo");
              try
              {
                  context.Korisnici.Add(korisnik);
              }catch(SqlException ex)
              {
                  Console.WriteLine(ex.StackTrace);
              }
              context.SaveChanges();
          }
  
              return View();
      }
  </code></pre>