Entity Framework and LINQ To SQL are somewhat similar, and can be used in a very similar way, code-wise, but
they have some important differences. EF also uses LINQ. Some notable
differences are:
- LINQ to SQL is largely SQL Server only, not so much by design as by implementation. The EF is designed to support, and does support, multiple DBs, if you have a compatible ADO.NET provider.
- Out of the box, LINQ to SQL has a very poor story for DB metadata changes. You have to regenerate parts of your model from scratch, and you lose customizations.
- The EF supports model features like many-to-many relationships and inheritance. LINQ to SQL does not directly support these.
- In .NET 3.5, LINQ to SQL had much better support for SQL-Server-specific functionality than the EF. This is mostly not true in .NET 4; they're fairly similar in that respect.
- The EF lets you choose Model First, DB First, or Code First modelling. LINQ to SQL, out of the box, really only supports DB First.
For
new development, EF is the recommended technology. LINQ to SQL is not
being actively enhanced anymore.
References:
No comments:
Post a Comment