Dela via


SQL Server Compact 3.5 and LINQ to SQL

SQL Server Compact 3.5 is the default database installed with Visual Studio 2008. Using SQL Server Compact 3.5 (Visual Studio)

This topic outlines the key differences in usage, configuration, feature sets, and scope of LINQ to SQL support.

Characteristics of SQL Server Compact 3.5 in Relation to LINQ to SQL

By default, SQL Server Compact 3.5 is installed for all Visual Studio editions, and is therefore available on the development computer for use with LINQ to SQL. But deployment of an application that uses SQL Server Compact 3.5 and LINQ to SQL differs from that for a SQL Server application. SQL Server Compact 3.5 is not a part of the .NET Framework, and therefore must be packaged with the application or downloaded separately from the Microsoft site.

Note the following characteristics:

  • SQL Server Compact 3.5 is packaged as a DLL that can be used against database files (.sdf extension) directly.

  • SQL Server Compact 3.5 runs in the same process as the client application. The efficiency of communication with SQL Server Compact 3.5 can therefore be significantly higher than communicating with SQL Server. On the other hand, SQL Server Compact 3.5 does require interoperability between managed and unmanaged code with its attendant costs.

  • The size of the SQL Server Compact 3.5 DLL is small. This feature reduces the overall application size.

  • The LINQ to SQL runtime and the SQLMetal command-line tool support SQL Server Compact 3.5.

  • The Object Relational Designer does not support SQL Server Compact 3.5.

Feature Set

The SQL Server Compact 3.5 feature set is much simpler than the feature set of SQL Server in the following ways that can affect LINQ to SQL applications :

  • SQL Server Compact 3.5 does not support stored procedures or views.

  • SQL Server Compact 3.5 supports only a subset of data types and SQL functions.

  • SQL Server Compact 3.5 supports only a subset of SQL constructs.

  • SQL Server Compact 3.5 provides only a minimal optimizer. It is possible that some queries might time out.

  • SQL Server Compact 3.5 does not support partial trust.

See Also

Other Resources

Reference (LINQ to SQL)