Chapter 8. Advanced LINQ to SQL features
This chapter covers:
- Handling concurrency
- Working directly with the database using pass-through queries, stored procedures, and user defined functions
- Improving the business tier with compiled queries, partial classes, partial methods, and object inheritance
- Comparison of LINQ to SQL with LINQ to Entities
In the last couple of chapters, we discussed the core components of working with relational data using LINQ to SQL. We saw how the mapping metadata combined with the IQueryable interface and expression trees to enable us to apply the same LINQ to Objects query expressions to relational data stores. By leveraging common APIs, we can eliminate vast amounts of data plumbing code and focus more directly on the business needs.
In this chapter, we’re going to extend the basic concepts and see some of LINQ to SQL’s more advanced features. We’ll begin by expanding on our discussion of the object life cycle, focusing on concurrency and transaction issues. We’ll continue by exploring how we can work more directly with the database and take advantage of some of the more specific functionality offered by SQL Server. Moving beyond the data tier, we’ll look at options LINQ to SQL gives us to customize the business tier, including precompiling query expressions, using partial classes, and polymorphism via inheritance. We’ll conclude by briefly exploring the upcoming Entity Framework as an alternative to LINQ to SQL for accessing relational data.