Saturday, August 02, 2008

LINQ and Entity Framework Posts for 7/30/2008+

Note: This post is updated daily or more frequently, depending on the availability of new articles.

Updated 8/3/2008: Additions and updates

Steve Naughton Demos Use of the ADO.NET Dynamic Data Futures’ AutoComplete and CascadingFilter FieldTemplates

Windows client UIs commonly apply an AutoComplete feature that fill lists with partial-matching combo box selections while you type. But this feature appears less commonly in Web forms. Steve’s Dynamic Data and Field Templates - An Advanced FieldTemplate of August 2, 2008 describes how to combine the AutoCompleteFilter.asmx, AutoCompleteStyle.css, and AutoComplete.ascx files from the ADO.NET Dynamic Data Futures Project download on CodePlex to create an AutoCompleteText_Edit FieldTemplate.

If your WebForms’ combo box lists grow to exceed your page height, you probably need to group selections by category, which requires what the ADO.NET Dynamic Data team calls a CascadingFilter. The CascadingFilter FieldTemplate also is part of the ADO.NET Dynamic Data Futures Project download from CodePlex.

Steve’s Dynamic Data and Field Templates - A Second Advanced FieldTemplate second post of August 2 shows you how to use the CascadingFilter field template to group a Product combo box by Category using the Northwind sample database and LINQ to SQL data sources.

Added: 8/3/2008

Michael Neel Uses LINQ to XML to Generate XHTML

His Using LINQ to generate HTML post of August 3, 2008 shows how to use LINQ to XML expression syntax and the XElement type to generate XHTML to populate agenda pages for the CodeStock Website.

Added: 8/3/2008

Eric White Uses LINQ to XML to Minimize Lines and Speed-Read Code

Eric’s LINQ Reduces Line Counts and Makes Code “Pop” post of August 2, 2008 demonstrates how to move from traditional imperative-style coding to a functional approach with LINQ to XML. A simple example shortens a 22-line foreach method to 12 lines of much easier-to-read method that uses chained LINQ to XML method-call syntax.

Added: 8/3/2008

Michael Neel Uses LINQ to XML to Generate HTML

His Using LINQ to generate HTML post of August 3, 2008

Dell Attempts to Purloin “Cloud Computing” Trademark

Dell Inc. isn’t short on chutzpa. The Round Rock computer maker has redefined the term “Cloud Computing” and is attempting to obtain a trademark on it for a wide range of computer-related services, none of which conform to the accepted definitions for cloud computing of which I’m aware. Wikipedia’s entry is closest to the mark for me.

For more details, see my Dell Attempts to Purloin “Cloud Computing” Trademark post of August 2, 2008.

Updated: 8/3/2008

Drag-and-Drop Master/Details Windows Forms Still Missing from Entity Framework SP1 Beta

LINQ to SQL has supported drag-and-drop generation of master/details and master/details/subdetails forms from the Data Sources window since its first appearance in an early Orcas beta release.

The version of Entity Framework (EF) v1 in the Visual Studio 2008 SP1 Beta release can drag-and-drop TextBox or DataGridView icons from the Data Sources window to the form in design mode, but the Data Source nodes don’t include EntityReferences, such as Order.Employee and Order.Shipper, or EntityCollections, such as Customer.Orders or Order.Order_Details. Neither does the current EF v1 release display foreign key values unless they’re part of a primary key, such as Order_Detail.OrderID and Order_Detail.ProductID.

Read more about the problem at Drag-and-Drop Master/Details Windows Forms Still Missing from Entity Framework SP1 Beta of August 2, 2008.

Updated: 8/3/2008

Andrew Matthews Seeks Community Help with Enhancing LINQ to RDF

Andrew’s Wanted: Volunteers for .NET semantic web framework project post of August 2, 2008 observes:

LinqToRdf* is a full-featured LINQ query provider for .NET written in C#. It provides developers with an intuitive way to make queries on semantic web databases. The project has been going for over a year and it’s starting to be noticed by semantic web early adopters and semantic web product vendors. LINQ provides a standardised query language and a platform enabling any developer to understand systems using semantic web technologies via LinqToRdf. It will help those who don’t have the time to ascend the semantic web learning curve to become productive quickly.

He’s seeking help for development, testing, and promotion, as well as several new features:

  • Reverse engineering tool
  • Tutorials and documentation
  • Supporting SQL Server
  • Porting to Mono
  • SPARQL Update (SPARQUL) support
  • Demonstrators using large scale web endpoints

Eugenio Pace Explains SQL Server Data Services’ Entity Versioning and Concurrency Conflict Management

SOAP requests to SSDS entities require a Scope with an instance of the new (in Sprint 3) VersionMatch class to manage concurrency conflicts. Eugenio’s Concurrency in SSDS post of August 1, 2008 shows you how to implement and test it.

Chad Myers Proposes Expression-Tree Query Objects for Use by Repositories

Chad concludes that the single repository model has …

the potential for business logic (also known as ‘where’ clauses) to creep into the repository which would be bad. Perhaps a better alternative would be to encapsulate the specific logic of a given query into an object. You could then have this object produce something that the repository could (blindly, decoupled) use to query on.

This approach allows you to maintain the one repository approach, yet still have encapsulated domain-specific queries. Plus, you can test your queries independently of the repository which is a huge benefit.

He then goes on to demonstrate using an expression tree to create the query object in Query Objects with the Repository Pattern (Part 1) of August 1, 2008 and enhances the objects by coupling then with AndAlso and OrElse expressions in Query Objects with the Repository Pattern (Part 2) of August 2, which provides a full query object implementation.

Comment: Ayende Rahien contends that Chad’s syntax “leaves a lot to be desired” in his Unreadable Linq post of August 2, 2008.

Mehfuz Releases LINQ to Flickr 1.4 with New Features

Mehfuz’ Athena - A LINQ to flickr API (Release 1.4) post of August 2, 2008 says:

I have updated it with the latest LINQExtender (pre release version)  containing updated Object Tracking Service (OTS) that will enable it to update photos and comments as if like LINQ to SQL.

It also adds Extras support, which enables querying with Extras enum for additional information about your photos.

Article about ADO.NET Data Services by the Flaskos in August 2008 MSDN Magazine

Elisa and Mike Flasko’s “Expose And Consume Data in A Web Services World” article appears in the August 2008 issue of MSDN Magazine. In addition to demonstrating the usual Entity Framework back-end, the article shows you how to create an Astoria service for an in-memory CLR objects.

Note: Julie Lerman wrote Write On!: Create Web Apps You Can Draw On with Silverlight 2 for this issue. Read more about it in her Drawing in Silverlight Article in MSDN Magazine of July 2, 2008.

Input Needed for Alternative Approaches to Implementing POCO in Entity Framework v2

Alex James is is seeking the answers to the following three questions for enabling Plain Old CLR Objects (POCO) in EF v2:

  1. What are the interesting scenarios for using the state management API in POCO scenarios?
  2. What API pattern is better? Having an explicit method to compute the current state based on the snapshot comparisons or having the state to be computed automatically when accessing the state?
  3. Is it better to have an Invalid state for entries or should the state manager just throw exceptions immediately every time it finds a change on a key?

His Discussion about API changes necessary for POCO post of August 1, 2008 offers a extensive discussion of the implications of alternatives for questions #2 and #3.

Favorable Competitive Side-Effects from the Entity Framework v1 Release Anticipated

Gary Short of Developer Express concludes that XPO Will Benefit from the Entity Framework (August 1, 2008) because:

[M]any companies and many individual developers too for that matter, will not contemplate looking at a new architectural paradigm until such time as it appears on the Microsoft development stack. …

With the release of Visual Studio 2008 SP1 this summer, that is all about to change, an ORM tool (albeit a flawed one) will then become a first class citizen in the Microsoft development stack. That fact will open up the world of ORM to many more people, and as those people explore that new world many will drift to XPO and other ORM tools, making 2009, in my opinion, a great year to be in the ORM space.

Mike Amundsen Posts Code and Demo for Twitter-Like SSDS Application

Mike’s Online Guestbook Demo App up and running post in the of July 31, 2008 in the SQL Server Data Services (SSDS) - Getting Started forum announces the availability of source code for his SSDS Online Guestbook application that logs 140-character messages similar to Twitter Tweets.

Mike describes his project:

This app uses a single Container (guestbook) with two Entity 'Kinds' (guest and message). Users can create an account and then post messages for everyone to see. You can also filter the message list by guest's nickname. 

I'm testing out the user account authentication pattern (a custom HTTP Basic using cookies for browsers) and the notion of running queries in a single container over multiple 'Kinds.'  I am also working on a solid list/query caching (and cache _invalidation_) pattern as SSDS does not yet support ETags/caching of lists.

He also has a live demo of the application running on his site.

Mary Jo Foley Describes SCOPE, Microsoft’s SQL-Like Answer to MapReduce for Parallel Queries Against Massive Data Sets

Mary Jo describes Microsoft Research’s Structured Computations Optimized for Parallel Execution (SCOPE) in her Microsoft’s road to the cloud is paved with parallelism post of July 31, 2008. The “SCOPE: Easy and Efficient Parallel Processing of Massive Data Sets” whitepaper is the basis of a Microsoft presentation at the Very Large Data Bases 2008 conference scheduled for August 23 – 28, 2008 in Auckland, New Zealand.

Mary Jo quotes Greg Linden, a former Amazon developer who founded and now works in Microsoft’s Live Labs group:

Scope is similar to Yahoo's Pig, which is a higher level language on top of Hadoop, or Google's Sawzall, which is a higher level language on top of MapReduce. But, where Pig focuses on and advocates a more imperative programming style, Scope looks much more like SQL.

Gregg concludes his post:

Please see also my past posts on related work, including "Yahoo, Hadoop, and Pig Latin", "Sample programs in DryadLINQ", "Automatic optimization on large Hadoop clusters", and "Yahoo Pig and Google Sawzall".

The white paper notes that:

“Microsoft has developed a distributed computing platform, called Cosmos, for storing and analyzing massive data sets. Cosmos is designed to run on large clusters consisting of thousands of commodity servers. Disk storage is distributed with each server having one or more direct-attached disks.”

Mary Jo mentioned Cosmos in her Windows Live Platform Services: A guide for the perplexed post of March 6, 2008.

I don’t believe that SCOPE or Cosmos have a direct relationship to SQL Server Data Services (SSDS) today. However, one of the reasons that SSDS initial design is schemaless, implements flexible entities, and has little resemblance to traditional relational database management systems (RDBMSs) might be compatibility with a future SSDS upgrade or different version that runs under SCOPE and uses the Cosmos file system.

Comment: Ayende Rahien has a lot to say on the topic in his Thinking about Cloud Computing post of August 2, 2008.

Bart De Smet Updates LINQ to ActiveDirectory

Bart’s LINQ to AD - Refresh Release 1.0.1 Available post of July 31, 2008 announces an update to LINQ to AD (formerly LINQ to LDAP) that adds the following features:

  • byte[]- and GUID-valued directory attributes
  • Bug fix for non-constant EndsWith, BeginsWith and Contains clauses
  • Introduction of DirectoryContext with support for nested contexts and direct update support
  • Updated samples to use the new available features

Mike Taulty on Calling ASMX Web Services from Silverlight 2 Clients

Mike’s Silverlight 2 Beta 2 - ASMX Services & XmlSerializer post of July 31, 2008 verifies that you can call ASMX services from Silverlight 2 Beta 2 when those services use the XmlSerializer instead of the DataContractSerializer.

Steve Naughton Discovers a Fifth ASP.NET Dynamic Data Custom Page Type

ASP.NET Dynamic Data maven Steve Naughton finds a fifth custom Page type and demonstrates how to code for the user’s current culture in his Dynamic Data Custom Pages Part 5: I18N? Internationalisation Custom Page post of July 31, 2008.

Rob Conery Replaces LINQ to SQL’s Traditional Lazy Loading with LazyList

Rob and Ayende Rahien come up with a new approach to Lazy Loading With The LazyList implementation of IList<T> that takes an IQueryable definition in its constructor. This July 30, 2008 post shows you how to include LINQ Let statements …

This is part of fooling Linq To Sql so it doesn't try to introspect this relationship and build some weird SQL statement. I had to create these methods and they are simply filter statements that return IQueryable<Product> (you can see these in the checked in Storefront code).

Rob concludes with the source code to implement LazyList<T>.

Ben Hoelting Questions the Future of ADO.NET DataSets After Microsoft Releases the Entity Framework

Ben stated "if you are creating new applications or just adding on features to your current app I would use LINQ or EF instead of ADO Datasets” and an earlier post and goes on to detail the reasons in his Are ADO.NET Datasets dead? post of July 30, 2008.

I don’t believe that DataSets are dead, but they’ll certainly be on life support in a year or two.

Data Platform Group Posts ADO.NET Data Services and Entity Framework Screencasts

Its “How Do I?” Videos — Data Platform Development page offers links to two recently added “How Do I” ADO.NET Data Services (Astoria) screencasts:

and the following screencasts for Entity Framework: