25.2. LINQ to Entities
At the time of writing, LINQ to Entities is still under development so some parts of the following discussion may vary in the final product. LINQ to Entities is a much larger set of technologies than LINQ to SQL. However, because it is still unreleased and likely to change, we will give only a rough overview of the technology in this chapter. Currently, to work with LINQ to Entities you need to download and install the ADO.NET Entity Framework and the ADO.NET Entity Framework Tools. It is likely that both of these will ship as a single update around the time of SQL Server 2008.
LINQ to Entities, like LINQ to SQL, is an object-relational mapping technology. However, unlike LINQ to SQL it is composed of a number of layers that define the database schema, entities schema, and a mapping between them. Although this adds quite a bit of additional complexity, it does mean that you have much richer capabilities when it comes to how you map your objects to tables in the database. For example, a customer entity might consist of information coming from the Customer and Individual tables in the database. Using LINQ to SQL you would have to represent this as two objects with a one-to-one association. With LINQ to Entities you can combine this information into a single Customer object that pulls data from both tables.
Let's walk through a simple example as an overview of this technology. Again we will use the AdventureWorksLT database and a Visual Basic Windows Forms ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access