1. Created new Database MVCMUSICSTORE
2. Ran script as is with the exception of removing the USE xxx data store reference
3. Database created successfully
4. Changed DB Connection string to:
<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=WEAPONX\BEAST;Initial Catalog=MVCMUSICSTORE;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
5. Ran the solution...Got this error:
Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.6. Followed the steps in this post: http://mvcmusicstore.codeplex.com/discussions/317690/
7. Ran the solution...Got this error:
An error occurred while executing the command definition. See the inner exception for details.8. After reading a post about how this message can sometimes come about when EF is expecting pluralized Entities and the tables are not pluralized (or vice versa) I looked at the offending line of code:
INNER EXCEPTION: {"Invalid object name 'dbo.Album'."}
return storeDB.Albums
.OrderByDescending(a => a.OrderDetails.Count())
.Take(count)
.ToList();
- comparing that to the table name 'dbo.Album', it seems my solution required EF to pluralize the entities
- so i removed the modifications to MusicStoreEntities.cs as stipulated in the step 6.
9. Ran the solution...it works - lovely jubely!
No comments:
Post a Comment