Manipulating Data Using LINQ

  • 8/15/2013

Getting started with the Entity Framework

This chapter has introduced you to LINQ to Entities, which provides a method of querying a database using a simple and straightforward query language. The most important idea to take away from this chapter is that LINQ to Entities makes it possible to focus on the information you need to work with, rather than the method used to obtain it. In order to define what information you need, a declarative language uses a set of keywords and operators that make it possible to tell the compiler what you want. LINQ to Entities queries are compiled into a form that the .NET Framework understands. So, there isn’t any hocus-pocus going on—LINQ to Entities simply makes it possible for you to get your work done faster and with fewer errors.

The chapter contains a number of examples. What you need to do at this point is play with those examples to determine how they work. If necessary, single-step through the code using the debugger to determine precisely how the queries work. Once you understand the queries as they appear in the chapter, make changes to them to see how different operators and keywords affect the output. The best way to gain an appreciation of how LINQ to Entities works is to play with it. Spend some time mixing and matching items until you gain a clear understanding of how each item works.

Chapter 7 moves on to another way of interacting with data, using Entity SQL. In this chapter, you gain an in-depth view of working with Entity SQL to perform specific tasks. As in Chapter 6, you start with a basic tutorial of how Entity SQL works, and then move on to examples that demonstrate how to use it. When you finish Chapter 7, you’ll be able to compare LINQ to Entities with Entity SQL to determine the strengths and weakness of each approach. You’ll also have a better idea of which technology you prefer to use to address a particular need.