Invalid object name 'dbo.Genres'.

May 19, 2011 at 7:19 AM

Hi , 

while doing step by step process i m getting this error :

System.Data.SqlClient.SqlException: Invalid object name 'dbo.Genres'.

please tell me where is problem

May 22, 2011 at 10:17 PM

Newton - Are you using the latest version of the tutorial? There was an issue with previous versions of the tutorial, but they were resolved months ago.

May 25, 2011 at 10:59 AM

@Newton : If you're using database first, Entity Framwework may encounter some problems when trying to pluralize names of tables.

So in your Entities class just override OnModelCreating to remove the pluralizing convention just like this :

protected override void OnModelCreating(DbModelBuilder modelBuilder)


Good Luck,

Good DotNetting.

May 31, 2011 at 5:44 PM


I  had the same error like Newton but after implementing the override solution above i get a similar error: Invalid object name 'dbo.Genre'.

The table mentioned is not anymore pluralized... What else could be wrong? My current connection string:

    <add name="MusicStoreEntities" connectionString="Data Source=PC80\MSSQL2008;Initial Catalog=ASPMVC;User ID=myuser;Password=1234" providerName="System.Data.SqlClient"/>
The user (for testing) is sysadmin so it has all the rights it need.