Cool Linq Example - Linq to Amazon
Fabrice’s weblog : Introducing Linq to Amazon
"As an example that will be including in the Linq in Action book, I’ve created an example that shows how Linq can be extended to query anything.
This example introduces Linq to Amazon, which allows querying Amazon for books using Linq! It uses Linq’s extensibility to allow for language-integrated queries against a book catalog. The Linq query gets converted to REST URLs supported by Amazon’s web services. These services return XML. The results are converted from XML to .NET objects using Linq to XML.
For the moment, let’s look at the client code:
var query =
from book in new Amazon.BookSearch()
where
book.Title.Contains("ajax") &&
(book.Publisher == "Manning") &&
(book.Price <= 25) &&
(book.Condition == BookCondition.New)
select book;
I think this code speaks for itself! This is Linq to Amazon code. It expresses a query against Amazon, but does not execute it... The query will be executed when we start enumerating the results.
..."
I’m not how I feel about the new "Linq to blablabla" name scheme (DLinq, XLinq were so short and easy to say yet were quite descriptive... IMHO), I do dig Linq. The above post examples the coolness to come...
Technorati Tags: Linq
1 comment:
Maybe we should call this ALinq ;-)
Post a Comment