I'm reading a tutorial on MVC3 http://www.asp.net/mvc/tutorials/mvc-music-store-part-4.
There is a code that goes to web.config :
<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>
Is it supposed to create an sdf file when the application is ran ? Cause it doesn't. I'm totally new to MVC3. Thanks!
I have read and completed the tutorial you are referring to and yes, the sdf (SQL Server Compact) file is supposed to be created when your first run the tutorial.
There could be a host of reasons why it is not being created for your but I'll address the two most common ones.
1) Platform requirements. Make sure you have installed SQL Server Compact runtime and tools SQL Server Compact 4.0 - including both runtime and tools support http://www.microsoft.com/web/gallery/install.aspx?appid=SQLCE;SQLCEVSTools_4_0
2) You've added the App_Data folder by Right Clicking on the site project and selecting 'Add ASP.NET Folder' -> App_Data
3) You wired up the database initializer in the Application_Start()
method in the Global.asax.cs by adding the following line
protected void Application_Start()
{
System.Data.Entity.Database.SetInitializer(
new MvcMusicStore.Models.SampleData());
//... other lines follow
Make sure you follow the steps carefully in Step 4 - http://www.asp.net/mvc/tutorials/mvc-music-store-part-4
Let me know if this helps