Chapter 7. LINQ to SQL: Modeling Data and Tools

The best way to write queries using LINQ to SQL is by having a DataContext-derived class in your code that exposes all the tables, stored procedures, and user-defined functions you need as properties of a class instance. You also need entity classes mapped to the database objects. As you have seen in previous chapters, you can create this mapping by using attributes to decorate classes or via an external XML mapping file. However, writing mapping information by hand is both tedious and error-prone; fortunately, there are some tools that can help you accomplish this task.

This chapter covers the file types involved in mapping entity classes to database objects, and the tools available to generate this ...

Get Programming Microsoft® LINQ in Microsoft .NET Framework 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.