Support for the new embedded database in ASP.NET

Original author: Scott Gu
  • Transfer
sql ce 4Just the other day, I talked about the new IIS Express and told about our work on the improvements that we made to make life easier for ASP.NET developers.

And today's post will continue the topic of simplifying development and will reveal information about our developments in the field of databases. In fact, I want to announce the completion of our work on the free SQL Server Compact Edition (SQL CE) in ASP.NET applications. This allows us to simplify the development of the database.
 
 

SQL Server Compact Edition 4


SQL CE is a completely free, built-in database engine. We will provide access to the first public beta very soon. The 4th version was developed and tested with a focus on working with ASP.NET web applications.

Work with existing APIs


SQL CE works with existing .NET APIs and supports SQL Server compatible query syntax. This means with SQL CE. you can use existing APIs for working with data such as ADO.NET, as well as higher-level ORMs like Entity Framework and NHibernate. Almost any existing data API that supports the ADO.NET provider model will work.

All this allows you to use debugged programming skills when working with data today.

No installation required


In order to use SQL CE, you are not required to start the installation or install the database server. Now just copy the SQL CE executable files to the \ bin folder of your ASP.NET application, and then your web application can use it as a database engine. No installation or additional security rights are required, it just started and works.

Applications are free to include in SQL CE. You simply copy the web application to any server and it works.

Database files are stored on disk


SQL CE stores databases as files (with the extension .sdf). You can store these files in the project directory \ App_Data, there is no need to register them for use in the application.

The SQL CE engine runs in the memory of your ASP.NET application. When the application finishes its work, it is automatically unloaded.

Shared hosting already supports SQL CE 4


SQL CE 4 can already work on ASP.NET 4 hosting with an average level of trust in applications, the hoster does not need to install anything. Hosters don’t need to do anything for SQL CE to work.

You can now deploy the application in general using one FTP, just copy the project folder and you're done.

SQL CE will run in your application on the remote host itself.

Support in Visual Studio 2010 and Visual Web Developer 2010 Express


In the near future, VS 2010 and Visual Web Developer 2010 Express will have tools that support working with SQL CE 4. You can add SQL CE files to ASP.NET projects, use Visual Studio Server Explorer to create and edit tables, and use high-level designers as the Entity Framework (see below) for modeling and binding the database to classes that will be used in LINQ in the future. In addition to the data API you already know, you can use the same development tools for SQL CE.

image



Development and Production


SQL can be used on the developer's machine and for simple production sites. Since the 4th version of SQL CE, we have done some technical work and made sure that SQL CE will not crash or deadlock when multi-threaded scripts occur, as is the case with ASP.NET. This is a huge change, compared to the previous version of SQL CE, which we developed only for the client side, plus - it blocked the work in the web environment. And now, SQL CE 4 can be used without problems on web servers.

There are no licensing restrictions for using SQL CE.

Simple migration to SQL Server


SQL CE is an embedded database, which makes it ideal for simple scripts. For highly loaded sites and applications, you probably want to migrate to SQL Server Express (free), SQL Server or SQL Azure. Server data has better scalability, more development capabilities (including features such as stored procedures that are not supported in SQL CE), and more advanced data management capabilities.

We will provide migration tools that allow you to take the SQL CE database and easily upgrade to SQL Server Express, SQL Server or SQL Azure. You do not have to make any changes to the code to upgrade your SQL CE database to SQL Server or SQL Azure. Our goal is to give you the opportunity to simply change the connection string to the database in web.config and continue to work with the application.

conclusions


SQL CE 4 provides a simple, lightweight database that you can use in ASP.NET applications. Allows you to quickly start working on a project without requiring the installation of a full-fledged database on the local developer machine. Due to compatibility with the full version of SQL Server, your code uses the same APIs (ADO.NET, Entity Framework, NHibernate, etc.)

. You will be able to quickly deploy SQL CE databases on hosting for simple sites and applications. In the future, with increasing traffic and load, you can upgrade the database to SQL Server Express, SQL Server or SQL Azure without changing the code.

We will provide access to the first public beta version of SQL CE 4 (along with IIS Express and other cooler things, which I will write more about) next week.

Also popular now: