Thursday, May 5, 2011

LINQ to REST (Cloud Programming)


LINQ to REST
Roy Fielding, one of the authors of the Internet Engineering Task Force ’ s HTTP specification (RFC 2216),
introduced the term Representational State Transfer and its abbreviation REST in his 2000 doctoral
dissertation, “ Architectural Styles and the Design of Network - based Software Architectures. ”
Wikipedia ’ s definition of REST begins as follows:
REST strictly refers to a collection of network architecture principles that outline
how resources are defined and addressed. The term is often used in a looser sense to
describe any simple interface that transmits domain - specific data over HTTP
without an additional messaging layer such as SOAP or session tracking via HTTP
cookies. . . . Systems that follow Fielding ’ s REST principles are often referred to as
RESTful .
LINQ to REST is a component of ADO.NET Data Services (ANDS), which began life in early 2007 as a
Microsoft Live Labs incubator project named Astoria . Astoria used the term REST in the “ looser sense ” to
describe an API that defines a method for delivering relational data over the Web with a simpler API
than SOAP. At that time, many Web - centric organizations were creating “ open, ” RESTful APIs for
accessing a variety of data types, including data structures, that support HTTP as the wire protocol and
integrate easily with AJAX and other technologies, such as Adobe Flash and Microsoft Silverlight, to
deliver lightweight client programs that run in popular browsers. The common term for these programs,
which developers often use to create Web mashup s, is Rich Internet Application (RIA).
The incubation team chose the codename Astoria because the project originally was subtitled “ Data
Service in the Cloud ” and Astoria is the cloudiest city in the United States.
Mashup originated as a pop - music term that means creating a new tune by mixing multiple existing
tunes. In the Internet context, mashup means combing data from multiple sources into a Web page or
application. An early example was associating Web - based maps with real - estate classified
advertisements on Craigslist and similar sites.
Microsoft insists that RIA is the abbreviation for Rich Interactive Applications.
REST transfers state between resources (a source of specific information) and clients. Resources,
such as data tables, rows, and columns, must be uniquely addressable. RESTful resources must expose
to clients a uniform interface that has a set of predefined operations and content types; these
requirements are similar to those of a SOAP service ’ s contract. ANDS meets these criteria. The client/
server protocol for transferring state must be stateless, cacheable and layered. HTTP satisfies these
requirements, enables state to pass through most firewalls, and provides predefined methods for client
authentication.
Google Base, an attribute - centric (non - relational) database, was an early RESTful, publicly accessible
Web data source; Amazon announced in December 2007 the beta version of SimpleDB, another cloud -
based non - relational RESTful data store that stores data in key - value pairs. The initial Astoria
implementation, which featured a publicly accessible Web implementation of the Northwind sample
database and a few other data sources, used the Entity Framework (EF) as its preferred back - end
object/relational data store. ANDS with Entity Framework as object data source is one of the topics of
Chapter 15 . Figure 8 - 3 is a data flow diagram for ADO.NET Data Services using EF, LINQ to SQL, or
other LINQ - compliant data sources.
Astoria implements the IUpdatable < T > interface for EF so EF data sources are updatable. LINQ to
SQL and other data sources that don ’ t implement IUpdatable < T > are read - only.