SOA data access: Flexible data access using LINQ to SQL and the Entity Framework

Source: Internet
Author: User

This article supporting source code

This article uses the following techniques:

LINQ to SQL, ADO. NET Entity Framework and SOA

Directory

To create a data access layer

Persisting individual objects

Tracking changes across service boundaries

Configuring clients

Summarize

To date, Microsoft has published two products for developers that are designed to reduce the impedance mismatch between relational data domains and object-oriented programming: LINQ to SQL and Ado.net Entity Framework. With either product, you do not have to write most of the probe code to achieve object persistence. However, applying these object-relational mapping (ORM) technologies to service-oriented application architectures poses a new challenge for application developers.

For example, how to create a data access layer (DAL) that separates object persistence from other parts of the application so that you can swap out another provider if needed using an ORM provider. How do I track changes to an entity without a LINQ to SQL or Entity Framework installed by the client? How can you insert, update, and delete multiple entities in a single transaction once by simply invoking the service?

In this article, I'll make a brief introduction and provide some advice on how to solve the above problems. First, I'll create a DAL for processing orders based on the Northwind sample database. Two implementations of the DAL (one using LINQ to SQL, one using the Entity Framework) depend on an interface (see Figure 1). Both LINQ to SQL and the Entity Framework have tools that build entities based on the database schema, but the DAL does not use these entities, but rather exposes only data transfer objects (DTO) that are typically ignored when it comes to the persistence of itself.

Figure 1 Service-oriented architecture for order Processing applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.