Entity Framework, Linq to SQL & SQL CE

I am using LINQ etensively in TagFlo. It is what is used to connect all application to the backend database containing all the information on the photos. I was previously using ADO.NET to connect to my DB. ADO.NET makes SQL like calls to insert, update and delete information from the database. LINQ is a much more abstract way of accessing the db. You can pull off some interesting tricks using it.

In order to map LINQ to you SQL based DB, you can use either Linq to SQL (L2SQL) or Entity Framework (EF). Linq to SQL gives you more of a direct mapping, where the different SQL column names are used directly in your queries. With EF you get to abstract your DB in a data layer. This, in theory, should make it easier to change the db without having to redo your program.

Both of these solutions are good solutions. The only problem is that not all of their features work with SQL Server Compact Edition (SQLCE). I am using SQLCE because I need a light weight DB technology to store and sort all the information about the photos in TagFlo. My decsion to use EF instead of L2SQL was based upon how much better it worked with SQLCE.

Here is a run down of the trouble each has working with SQLCE:

Entity Framework

  • Auto-generated keys for Identity columns are not support. That means that you are on the hook to provide unique indentifers. You can extend your Entities to handle this.

Linq to SQL

  • Does not automatically support Many-to-many relationships; which I have a few of in TagFlo.

Leave a Reply