Summary

In this chapter, we have used LINQ to SQL to communicate with the database in the data access layer, rather than use the raw ADO.NET APIs. We have used only one LINQ statement to retrieve product information from the database, and as you have seen, the updates with LINQ to SQL prove to be much easier than with the raw ADO.NET data adapters. Now, WCF and LINQ are combined together for our services, so we can take advantage of both technologies.

The key points covered in this chapter include:

  • Service Factory can be used to model the service, and generate source code for the service interface layer projects.
  • The data access layer should be modeled with LINQ to SQL designer.
  • Business entity classes are all located inside the LINQ to SQL designer file, within the data access layer.
  • The service interface layer and the business logic layer have to reference the data access layer in order to use the entity classes.
  • Client applications still communicate with the service by exchanging messages. The LINQ to SQL objects are not exposed to clients, and the technology used in the data access layer is transparent to the clients.
  • When updating the database in the data access layer, the updated entity has to be attached to a fresh LINQ to SQL DataContext object.
  • Concurrent updates are handled by LINQ to SQL naturally and easily. We just need to add one more column to the database, and LINQ to SQL will do the rest for us.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset