What is the difference between the database inside the App_Data folder and the connection to SQL Server?

I am new to .NET and, studying the structure of ASP.NET MVC2, I see that you can create a .mdf file inside the App_Data folder and connect to it, or you can connect to SQL Server.

What is the difference between them and the methods of interacting with the database? What are the advantages / disadvantages of one over the other?

+6
asp.net-mvc-2
source share
1 answer

The MDF in App_Data folder works for websites and web applications and only works with SQL Server Express (2005, 2008, 2008 R2). This is the version that is usually installed with Visual Studio, and which works great in the development environment.

SQL Server Express has several limitations on

  • number of CPUs used (1)
  • Max. database size (4 GB for 2005/2008, 10 GB for 2008 R2).
  • Max. The amount of RAM used (not more than 1 GB).

and much more. This is a great and free way to get into SQL Server development.

If you need the SQL Server performance level, then you are probably going to use the full version — Web, Workgroup, Standard, Enterprise, or any edition of the highest level DataCenter.

There's a fairly comprehensive Compare Microsoft SQL Server 2008 R2 editions - go check it out!

The programming experience should also be identical - in fact it is just a question about the ADO.NET connection string (and whether you need to have an instance of SQL Server Express installed locally).

The format of the database file is completely identical, so you can absolutely start with the .mdf file in the App_Data folder, and then move up to the full version of SQL Server - just attach the MDF file to the server instance, and now use this database. It works smoothly.

+6
source share

All Articles