O'Reilly logo

Programming Microsoft® LINQ in Microsoft .NET Framework 4 by Paolo Pialorsi and Marco Russo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required