title: NullException error in MVC first code entity
body: <p>I have MVC first code project but I get below error
  <a href="https://i.stack.imgur.com/ZbPph.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZbPph.jpg" alt="error pic"></a></p>
  
  <p>First code! So there is no default database.</p>
  
  <p>Model class</p>
  
  <pre><code>public class Applicant
  {
      public int ApplicantID { get; set; }
      public string UserName { get; set; }
      public string Password { get; set; }
      public int PhoneNumber { get; set; }
  }
  </code></pre>
  
  <p>Context class:</p>
  
  <pre><code>public class Context : DbContext
  {
      public List&lt;Applicant&gt; Applicants { get; set; }
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;Applicant&gt;().Property(r =&gt; r.ApplicantID)
                       .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
      }
  }
  </code></pre>
  
  <p>Applicant repasority class:</p>
  
  <pre><code>public  Applicant Create(string username, string password, int phoneNumber, out int existResult)
  {
      if (context.Applicants.Where(x =&gt; x.UserName == username).ToString() != null)
      {
          applicant = new Applicant()
          {
              UserName = username,
              Password = password,
              PhoneNumber = phoneNumber,
          };
          context.Applicants.Add(applicant);
          existResult = 1;
          return applicant;
      }
      existResult = 0;
      return applicant;   
  }
  </code></pre>
  
  <p>And I added below code to my web.config in my web solution:</p>
  
  <pre><code>  &lt;connectionStrings&gt;
      &lt;add connectionString="Data Source=.;Catalog=Homi;Integrated Security=True" providerName="System.Data.SqlClient" name="Context" /&gt;
   &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>