My entity name is \"Contact\" and my table name is \"Contact\". However, the default pluralization support is making EF4 to look for a table named \"Contacts\". Anybody has
I'm adding yet a third answer as my understanding of the question changes... is that bad of me? ;)
Like I said in my comment, I'm still learning and I haven't attempted this with an existing database yet. That said, hopefully one of these will help:
The post I mentioned by Scott Guthrie (http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx) has a comment by a certain Jeff that says this can help (I recommend reading the full comment as he explains in more detail):
Database.SetInitializer(null); //AddressBook being the context
I've also happened across a comment by Rowan Miller underneath this post (http://blogs.msdn.com/b/adonet/archive/2010/07/14/ctp4announcement.aspx?PageIndex=2) in the recent past. He suggests this may be an option:
public class ProductContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.IncludeMetadataInDatabase = false;
}
...
}
Hopefully one of these gets you on the right track.