If you use LINQ to SQL, you may wonder why Microsoft released yet another ORM (Entity Framework), while they already had one. You may also be confused, because it’s not obvious which one to choose. Anyway, the Entity Framework has its own shiny features that don’t present in LINQ to SQL. Besides, you can still use LINQ to retrieve data with the Entity Framework, in this case, it’s called LINQ to Entities, at the same time you can also use a SQL like language – Entities SQL. In this story I’ll show one particular feature of Entity Framework that certainly must interest many developers.
Basicall
y, Entity Framework provides a higher level of abstraction than LINQ to SQL. In fact, in hides the data level. So, you deal with objects that represent real entities, not database tables, like if you were using LINQ to SQL. I mean when you generate LINQ to SQL classes, it creates classes for each tables, even though those tables are merely junction tables without any reflection in our real life.
Let’s have a look at the example, to make things clear. More...