I am following some tutorials and I’m completely lost on how MVC/SQL Server connect.
I am going through a tutorial and the person mentions that the following code automatically creates a database for me:
<connectionStrings>
<add name="LibraryContext"
connectionString="Data Source = |DataDirectory|Library.sdf" providerName="System.Data.SqlServerCe.4.0"/>
Can you please tell me what the above code does in a simple and detailed way. What |DataDirectory|Library.sdf does and what SQL Server CE..etc…all of it.. PLEASE & THANK YOU!
SQL Server CE is the Compact Edition of SQL Server – basically your whole database in a single file (the
.sdffile) and the code to access it in a set of DLLs – no server installation needed.It works fine for most cases, but has limitations (no stored procedures etc.) – ErikEJ has a great comparison page comparing SQL Server CE to Express
the
|DataDirectory|part of your connection string refers to theApp_Datadirectory that’s been created in your web siteSo in the end, the database connection goes to a file in