I generated a database through entity framework. Here is the connection string:
<add name="AnnouncementsContainer" connectionString="metadata=res://*/Models.Announcements.csdl|res://*/Models.Announcements.ssdl|res://*/Models.Announcements.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\Database.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
This uses a file called Database.mdf. The application runs fine but there are two issues that I am having to deal with right now:
- Database Updates: Whenever I update the database using raw sql code I have to manually host this file myself in SQL Server Management Studio (I then detach the database and leave the rest to visual studio). The server appears in the Visual Studio server explorer but Visual Studio cannot connect to it to run SQL code. Where is Visual Studio hosting this file so that the application can get to the database but the IDE can’t?
- Profiling: I have created some stored procedures for entity framework and mapped them to the entities. It would be really nice to see if these entities are actually being executed. How can I see the stored procedures executing with a tool like SQL Profiler?
Here are some screenshots in case what I am saying isn’t clear:
SQL Server Management Studio:

Visual Studio Server Explorer:

As you see your connectionstring contains this part:
This means that it will take the file
Database.mdfstored in your|DataDirectory|(which defaults to App_Data folder in web projects) and it will attach it dinamically to the provided sqlexpress instance (in this case .\sqlexpress which means the sqlexpress instance running on localhost.\namedsqlexpress.