In LINQ to SQL, you can also access SQL Server Compact databases.
using (SqlCeConnection conn = new SqlCeConnection(@"Data Source=CustomerDB.sdf"))
{
using (var db = new CustomerDbDataContext(conn))
{
var customers = db.Customers.ToList();
foreach (var customer in customers)
{
Console.WriteLine(customer.FirstName + ", " + customer.LastName);
}
}
}
The SQL Server Compact feature set is much simpler than SQL Server and contains the following limitations that affect LINQ to SQL applications.