I am hitting this issue too. I have tried doing the scaffolding over and over.
* I am using Visual Studio Pro 2010 with its MVC 4 add-on.
* Also, I am using the local dev database instead of the local IIS database.
* I did not put the connection string in the web.config since the book said it would do it itself.
Anyway, I have created the Album.cs, Artist.cs, and Genre.cs classes. I have then run the scaffolding as the book states. After it runs, I see the views, controller, and the MusicStoreDBContext.cs in the Models folder.
However, when I navigate to the storemanager page, I see no changes to my project. If I check the Server Explorer > Data Connections, I do not see any new database even after clicking Refresh.
I have rebuilt the project.
I have confirmed that the web.config file has this connection string:
<add name="MusicStoreDBContext" connectionString="Data Source=.\SQLEXPRESS; Initial Catalog=MusicStoreDBContext-20130530204601; Integrated Security=True; MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
Still I am not seeing evidence of a database created.
** This creates a problem because when I create the MusicStoreDBInitializer class (in the Models folder), I get a error:
"The type or namespace name 'MusicStoreDB' could not be found (are you missing a using directive or an assembly reference?)"
- With that said, I notice that the DropCreateDatabaseAlways takes a context.
I get the error above with this code (which is from the book):
Code:
public class MusicStoreDBInitializer : DropCreateDatabaseAlways<MusicStoreDB>
I do NOT get that error with this code
Code:
public class MusicStoreDBInitializer : DropCreateDatabaseAlways<MusicStoreDBContext>
I notice that the text says "Name your context MusicStoreDB" but the screenshot has "MusicStoreDBContext" in the New Data Context window's field.
So, I am assuming I should use DropCreateDatabaseAlways<MusicStoreDBContext> since the file name in my Models folder is MusicStoreDBContext.cs, but I am still wondering why I am not seeing a database.
Is it possible I am looking in the wrong spot?
Is it possible I have some windows permission issue it is not throwing a flag/error about?