2012年12月4日 星期二

Unable to retrieve metadata for 'MvcMusicStore.Models.Album'.

When you practice this Tutorials at MVC Music Store. You may got this error message when you create the StoreManagerController: "Unable to retrieve metadata for 'MvcMusicStore.Models.Album'."


You can change:
<add name="MusicStoreEntities" connectionString = "Data Source=|DataDirectory|MvcMusicStore.sdf" providerName="System.Data.SqlServerCe.4.0"/>

to:
<add name="MusicStoreEntities" connectionString="Server=(LocalDB)\v11.0; Integrated Security=true; AttachDbFileName=|DataDirectory|MvcMusicStore.mdf" providerName="System.Data.SqlClient"/>