title: Why does EF 5.x use plural name for table?
body: <p>I've had some experiences in ORM framework such as Hibernate, even Entity Framework 3.0.</p>
  
  <p>By default, those frameworks use singular name for table. For example, class User will map to table User.</p>
  
  <p>But when I migrate to EF 5.x by using Visual Studio 2012, it uses plural name and causes many errors unless I manually map that class by using <code>TableAttribute</code> as:</p>
  
  <pre><code>[Table("User")]
  public class User {
      // ...
  }
  </code></pre>
  
  <p>Without <code>TableAttribute</code>, if I have a <code>DbContext</code> as below:</p>
  
  <pre><code>public CustomContext : DbContext {
      // ...
      public DbSet&lt;User&gt; Users { get; set; }
  }
  </code></pre>
  
  <p>Then calling:</p>
  
  <pre><code>var list = db.Users.ToList();
  </code></pre>
  
  <p>The generated sql looks like:</p>
  
  <pre><code>Select [Extent1].[Username] From [Users] as [Extent1]
  </code></pre>
  
  <p>Therefore, the error will occur because I don't have any table named <strong>Users</strong>. Futhermore, I refer to name tables in singular form to plural form. You can see why in <a href="https://stackoverflow.com/questions/3593582/database-naming-conventions-by-microsoft">this link</a></p>
  
  <p>I wonder why Microsoft implement EF 5.x that way rather than same to EF 3.0?</p>
  
  <p><strong>Updated:</strong></p>
  
  <p>We can tell EF not use pluralized name by using this code in the context class:</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
  
      base.OnModelCreating(modelBuilder);
  }
  </code></pre>
  
  <p>Even if EF tool generates pluralized name, it should keep the mappings to the original database, shouldn't it? Because some users might want to change a few name of fields on their class. EF 3.0 works well, but EF 5.x does not.</p>
  
  <p>Guys, can you give my a reason, please!</p>