15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32<br />

Data services<br />

WhaT ’ s in This ChaPTer<br />

➤<br />

➤<br />

➤<br />

➤<br />

➤<br />

➤<br />

➤<br />

Overview of WCF Data Services<br />

WCF Data Services hosting with CLR objects<br />

HTTP client access to WCF Data Services<br />

URL queries to WCF Data Services<br />

WCF Data Services with the ADO.<strong>NET</strong> Entity Framework<br />

Using the WCF Data Services .<strong>NET</strong> Client Provider<br />

Tracking, Updates, <strong>and</strong> Batching<br />

In the previous chapter you saw the ADO.<strong>NET</strong> Entity Framework used to easily create an object<br />

model to map to the database structures. The Entity Framework does not provide a way to get the<br />

objects across different tiers. This is where WCF Data Services come into play. WCF Data Services<br />

offers a WCF service to easily access data provided by an Entity Data Model or by simple CLR objects<br />

implementing the IQueryable < T > interface.<br />

oVerVieW<br />

The ADO.<strong>NET</strong> Entity Framework offers mapping<br />

<strong>and</strong> creates entity classes representing databases.<br />

With the data context from the Entity Framework,<br />

the data context stays informed about changes to<br />

data so that it knows what should be updated. The<br />

Entity Framework does not help when creating<br />

solutions over multiple tiers.<br />

Using WCF Data Services, you can use the Entity<br />

Framework (or a simple CLR object model) on<br />

the server side <strong>and</strong> send HTTP queries from the<br />

client to the service to retrieve <strong>and</strong> to update<br />

data. Figure 32 - 1 shows a typical scenario with a<br />

Windows client or a Web page using HTML <strong>and</strong><br />

JavaScript to send an HTTP request to the server.<br />

Windows<br />

Client<br />

HTML Client<br />

with<br />

JavaScript<br />

figure 32-1<br />

AtomPub Data<br />

HTTP Request<br />

HTTP Request<br />

JSON Data<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!