Sunday, May 04, 2008

LINQ and Entity Framework Posts for 5/1/2008+

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

Streaming LINQ Shows Potential for Complex Event Processing

Marc Adler's On Entitlements, Coral8 CCL, SQL, and LINQ post of May 4, 2008 describes difficulties he encountered in when porting an T-SQL query with two inner and two outer joins to Coral8's Continuous Computation Language (CCL) for a financial analysis project. He was able to implement the LINQ equivalent of his T-SQL query in about 10 minutes. His conclusion:

LINQ has a lot of goodness to it. LINQ is pervasive, and all flavors of LINQ are being developed. I can very well imagine that Microsoft is looking at versions of LINQ that could handle streaming data. Right now, I think that it would be fairly easy to hook up LINQ queries in a pipeline that would handle simple queries on streaming data. Adding streaming SQL constructs is very doable.

If Microsoft was to come out with a Streaming LINQ that is available as part of .NET, how would this affect the world of CEP? An immediate casualty might be NEsper.* ... But, longer term, I think that a combination of WCF, Streaming LINQ, and a version of Microsoft Analysis Services that was further geared to real-time streams would be a killer to the rest of the CEP industry.

* NEsper is an Open Source ESP/CEP Engine for .NET. ESP is an abbreviation for Event Stream Processing, which encompasses Complex Event Processing (CEP).

Marc is the technical lead for a CEP project at a major Wall Street investment bank. Entitlements in this post's context refers to persons entitled to view CEP results, not Social Security or Medicare.

In a comment to the post, Jon Riecke, Lead Platform Architect for Aleri, Inc., a CEP software vendor, mentioned that the upcoming 3.0 release of the Aleri Streaming Platform will base its pattern-matching facilities on LINQ syntax.

To find out more about CEP, tune into the Complex Event Processing Blog and Marco on CEP.

P.S. Bart De Smet just posted the final episode of his C# 3.0 Pattern Matching Series: The Return of the Pattern Matcher - Sample Code Available

Added: 5/4/2008 12:30 PDT

Andrew Matthews Updates LINQ to RDF v0.6 to VS 2008

From the How Did I Miss This Department: Andrew (a.k.a. the Wandering Glitch) released LINQ to RDF v0.6 on April 5, 2008. His Announcing LinqToRdf v0.6 post of the same date lists these improvements:]

  • LinqToRdf Designer and VS.NET 2008 extension completely rewritten
  • LinqToRdf Installer now includes the installer of LinqToRdf Designer (at no extra cost)
  • Project and Item templates now installed as part of LinqToRdf Designer
  • Generated object and data properties now get their own EntitySet or EntityRef.
  • Generates LINQ to SQL-style DataContext objects to hide query creation. Much Cleaner.

You can download LINQ to RDF v0.6 from GoogleCode.

Note: I probably missed this because there's no obvious RSS/Atom feed for the Wandering Glitch blog, only a Twitter feed.

Added: 5/4/2008 12:30 PDT

This Nine-Minute Video Gets You Up and Running with the Google App Engine

I received my Invitation to Try Google App Engine on Friday but didn't have time to try deploying my Google App Engine (GAE) SDK desktop test project until today. Fortunately, I found this 09:15 clip by a fast-talking Google Python guru on YouTube.

The clip covers building a simple UI with a Django template that stores messages in the data store and retrieves text messages by author with a GQL query. The segment on deploying the app to GAE starts at about 08:25.

Note: GoogleDevelopers has 122 videos about Google Web services, et al., including the Campfire One release presentation. If you're new to Python and like video tutorials, ShowMeDo is the place to start. Joscha Feth's Google App Engine & eclipse (PyDev) post has fully illustrated instructions for getting code completion with Eclipse, PyDev, and the GAE working.

As time permits, I plan to determine whether GAE is a contender for "data store in the cloud" status and a viable competitor to SQL Server Data Services.

Added: 5/4/2008 12:30 PDT

Colin Meek: Composing LINQ to Entities Predicates

In his LINQ to Entities: Combining Predicates post of May 2, 2008, Colin offers three choices to compensate for LINQ's lack of an Or operator when composing predicates:

  1. Chain Unions instead of Where clauses, which is inefficient.
  2. Build the predicate by hand with ParameterExpression and Expression statements, which is a pain.
  3. Write a utility function called Compose() to implement LINQ to Entities-friendly And and Or builder methods by leveraging the ParameterRebinder implementation of Matt Warren's Expression Visitor from his IQuerable Providers series.

Interesting approach.

Added: 5/3/2008 11:45 PDT

Live Mesh and LINQ to Mesh Updates

Live Mesh Blog and Forum

The Live Mesh Blog has a detailed Behind Live Mesh: How we run cloud services post of April 30, 2008 by dev lead Alex Mallet.

Early Live Mesh adopters don't seem to have found the Live Mesh Forum. It had only 145 users as of May 3, 2008 10:00 PDT.

LINQ to Mesh (From Ori Amiga's Channel9 Video)

The Mesh Operating Environment (MOE) SDK currently has Silverlight, Javascript and desktop C# libraries. (The SDK also supports IronPython, as Ori demonstrated, but not VB.) Unfortunately, the Mesh team won't say when the SDK might be available, other than vague references to PDC 2008.

Here's the sample code for a LINQ to Mesh query against a Mesh object that Ori didn't attempt to execute because of a bug found earlier (~50:00):

Mesh mesh = Mesh.Load(new Uri(@"https://preview/mesh.com"), 
                new NetworkCredential("someone@somewhere.com", "Basic", myCred))

var meshQuery = from meshObject in mesh.CreateQuery<CoreObject>()
                where meshObject.Title == "title"
                orderby meshObject.Title
                select meshObject;

According to Ori at ~51:00, "the query processor can figure out three things:

  1. Which part of the query can execute most efficiently in our back-end storage using fine-grained indices in the cloud and execute that query as close to the data as possible.
  2. In our Mesh Operating Environment, we can keep on processing and linking and querying over that data to answer the question you're asking in the LINQ query.
  3. And you can query over the data in your local machine."

SSDS and Live Mesh

Jamie Thomson's SSDS and Mesh post of May 1, 2008 proposes using Live Mesh to sync SSDS data, perhaps even between two Authorities. Here's the story on potential SSDS and Live Mesh interop:

  • Pablo Castro and the Astoria team are working on a sync model for "Astoria Offline."
  • The SSDS team said they "will support the full EDM/EF/ADO.Net V3 model in due time."
  • Nigel Ellis demonstrated in his Introducing SQL Server Data Services session at MIX08 using the Sync Framework to synchronize vCard contact data between Microsoft Access 2007 and SSDS v1.
  • Francois Ajenstadt, director of project management for SQL Server, said "The goal is to bring the API's between SSDS and Astoria closer together closer to Release."
  • Ari Amiga says the Mesh team has been "working a lot with the Astoria team to make sure that our query syntax is the same, our URL syntax is the same, so it all looks nice and beautiful."
  • Astoria now uses, Mesh supports and SSDS will support the Atom Publication Protocol (AtomPub).

Added: 5/3/2008 10:30 PDT

ADO.NET Data Services Article in Visual Studio Magazine

My "Manipulate Data in the Cloud with ADO.NET [Data Services]" is the cover story for Visual Studio Magazine's May 2008 issue. Here's the deck:

ADO.NET Data Services (formerly code-named "Project Astoria") delivers data from relational tables and Windows Live services to Web mashups and Visual Studio 2008 projects, including ASP.NET AJAX and Silverlight 2.0 rich Internet applications, as Representational State Transfer (REST) resources over HTTP in response to URI-based requests or LINQ to REST queries.

Mesh Connection: At about 50:00 into the Ori Amiga: Programming the Mesh Channel 9 video segment of April 24, 2008 Ori mentions that the Mesh team is working with the Astoria folks to make sure their query and URL syntaxes are the same.

Related Topics: John Udell suggests taking advantage of Astoria's record-level URL addressability to implement loosely-coupled collaborative list-making in his Stonewall Farm, Darby Brook Farm, and the collaborative curation of data post of May 2, 2008. Because of its flexible entity feature (ad-hoc addition of attributes to an entity) SQL Server Data Services might be even a better choice when the SSDS team enables offering public read-only access to a container.

Moved: 5/3/2008 to Manipulate Data in the Cloud with ADO.NET [Data Services] due to length.

Kevin Hoffman Releases Continuous LINQ (CLINQ) v.1.1

According to Kevin's CLINQ v1.1.0.0 Released! post of May 2, 2008, CLINQ 1.1 now includes:

  • Support for Continuous Aggregation. Now, in addition to being able to have your result sets automatically update themselves in response to changes in the source set as well as changes to items in the source set, you can have aggregate scalar values that continuously update in the same fashion. The following is a list of the supported aggregation types that can now be done continuously:
    • Average
    • Min
    • Max
    • Sum
    • Standard Deviation
    • Count
  • Brand new demo application. This demo application not only shows off the power of continuous queries and WPF data binding, but also shows you how to use continuous aggregates, create your own continuous aggregates, and how to databind a WPF GUI to a continuous aggregate value.
His post has a screen shot of the Stock Monitor demo application in action.

Added: 5/2/2008 10:30 PDT

Jeff Currier Wants Questions to Address in SSDS Best Practices Tech*Ed Session

Jeff says in his Speaking at TechEd post of May 1, 2008:

I'm heading down to Orlando in a couple of weeks to give a talk about best practices when it comes to SSDS.  I'm working on my talk outline and was curious if there were any topics in particular that the community wanted to hear about in the talk?

I've posted my topics in a comment.

Jeff's session is "Best Practices in Building Applications with Microsoft SQL Server Data Services," which has the following description:

This interactive session provides a hands-on roadmap for developing and managing applications that use Microsoft SQL Server Data Services (SSDS), details best coding practices, and answers questions related to using on-demand storage services for business solutions.

This appears to be the sole SSDS session at Tech*Ed 2008.

Added: 5/2/2008 10:00 PDT

Popularity of SaaS/PaaS and Web Services/SOA Gain 1% Over 2006 According to McKinsey/Sandhill Survey

This 19-page Enterprise Software Customer Survey 2008 report by consultants McKinsey & Co. and Sandhill Partners finds that:

Innovation in the software industry is on the upswing, with Software as a Service (SaaS) being a key driver. The SaaS model is becoming mainstream and this has led to the rise of a new generation of SaaS platforms (also referred to in the industry as Platform as a Service – PaaS).

The distribution of 857 responses to "Please select the most important trend impacting your business" are shown in the following table for 2006 and 2008:

Most Important Trend, Percent 2006 2008
SaaS/SaaS or PaaS Platform 30 31
Web Services/Service Oriented Architecture 24 25
Open Source 10 8
Offshoring/Globalization 15 13
Software Industry Consolidation 17 7
Others 4 16

A detailed analysis of SaaS/PaaS platforms, which include "cloud computing" starts on page 5. Page 6 concludes:

The momentum toward adoption of SaaS platforms is surprising. Nearly three-quarters of the companies surveyed prefer to adopt platforms in at least one of the three archetypes we identify here.

For platform vendors, the only falloff in interest comes at the largest enterprises, those employing more than 25,000 people. In short, nearly every company – or division of a larger enterprise – is a customer or a prospect for SaaS platforms.

Exhibits on pages 6 - 9 provide additional details on interest in various models SaaS/PaaS models.

BEA's Understanding the Cloud Computing/SaaS/PaaS markets: a Map of the Players in the Industry post of May 2, 2008 by Peter Laird and Kent Dickson has clear definitions of cloud computing, SaaS, PaaS, and Core Cloud Services, as well as a map and list of major players with links to their sites.

Added: 5/2/2008 11:30 PST

SSDS Finally Provisioning Private Beta Users at a Faster Pace

KellyAlt says in Onboarding early beta customers of May 2, 2008:

Over the past 4 weeks, we have been onboarding customers slowly.  Since the response to our restricted beta invitation was quite overwhelming, quite a few of you will experience some delays in getting an account.  The SSDS team is doing everything possible to get you onboarded as soon as possible.  I am happy to say that I am seeing the pace pick up a bit over the last week.

I've been working with SSDS for about three weeks and have written a WinForm test harness to give SSDS v1 a thorough workout. Here's the UI when using the REST protocol to upload a Northwind Employee entity with a base64Binary-encoded bitmap:

Watch for my "Test-Drive SQL Server Data Services" feature article coming in the July 2008 issue of Visual Studio Magazine, which will include complete C# source code for the test harness.

Added: 5/2/2008 08:30 PDT

Ryan Dunn Interviews Tudor Toma and Soumitra Sangupta About the Business Value of SSDS

In Channel9's Tudor Toma and Soumitra Sengupta: SQL Server Data Services Business Value segment of May 1, 2008 (28:19):

Ryan sits down and talks with the Group Program Manager Tudor Toma and Architect Soumitra Sengupta about the business value of SSDS.

Added: 5/1/2008 17:00 PDT

David DeWinter Adapts T4 Templates to Generate T-SQL Stored Procedure Scripts for Entity Data Models

The Text Template Transformation Toolkit (commonly called T4) is a free Microsoft code generation engine for VS 2005 and later that supports their Domain Specific Languages and Software Factories toolkits. The Hilton Giesenow and Oleg Sych blogs have posts about T4.

David's Entity Framework Stored Procedure Generation post of April 26, 2008 describes the template:

The T4 template we created is designed to be a general purpose way to generate CUD procedures for an Entity Framework model. ...

The template not only generates EF-compliant sprocs, but it also considers only the tables that are in the SSDL of the model file. Unfortunately, the template must query the database (SQL Server 2005 only!) in order to make all the decisions necessary to create the output file. However, this is usually quite fast on generations other than the first one.

The template would have been a big time saver when I wrote 40+ stored procedures for my forthcoming book's test project.

Added: 5/1/2008 13:40 PDT

Rick Strahl Posts LINQ to SQL and WCF JSON/REST Samples from His ASP.NET Connections Presentations

Rick's ASP.NET Connections Slides and Samples Posted item of May 1, 2008 provides links to sample code and PowerPoint slides from his three presentations at the ASP.NET Connections conference in Orlando. Following are Rick's abstracts of the sessions:

Building a LINQ to SQL Business Layer for ASP.NET Applications

LINQ to SQL - although completely object based, is still little more than a sophisticated data access layer and so a business object layer is still needed to abstract business logic and provide common functionality that every business related entity requires. The business layer provides a few high level abstractions to the CRUD layer as well as a host of low level features that allow better control for low level data access in case LINQ to SQL queries are ill suited for queries and operations that cannot be performed with LINQ to SQL at all.

This session and its sample code is the culmination of Rick's extensive writing about LINQ to SQL in enterprise-grade projects.

WCF 3.5 JSON and REST Services

WCF 3.5's AJAX support has been made nearly as easy and comprehensive as ASMX functionality and there are many options of how data can be accessed over HTTP now with official protocol support for the webHttpBinding. This session starts of with examples of pure REST URLS and demonstrates features like URL templating, different response formats (wrapped, bare, XML, JSON) as well as the various different options for serving in this fashion. There are also examples of serving up raw data such as images or HTML content out of the REST based API. The remainder of the session focuses on AJAX functionality and explores different ways that WCF services can be called.

If you're interested in ADO.NET Data Objects, which support WCF JSON and REST protocols, don't miss this session.

Ajax Alternatives: Using jQuery with ASP.NET

Off-topic for this blog, but very interesting if you're into AJAX.

Note: Slides are the last file in the ZIP containers.

Frans Bouma Adds LINQ to SQL Refactoring and ASP.NET Dynamic Data Support to LLBLGen Pro

LLBLGen Pro has its own native LINQ implementation, but Frans announces in his Linq to Sql support added to LLBLGen Pro post of May 1, 2008 that latest version (2.6 beta) of LLBLGen Pro includes templates for generating LINQ to SQL classes and mapping (*.dbml) files.

This means you can use LLBLGen Pro's code generator to update your LINQ to SQL data model from SQL Server metadata automatically. Microsoft's LINQ to SQL implementation requires manually updating the data model for schema changes. (ADO.NET Entity Framework's Model Browser has an Update Model from Database context menu command.)

Frans says, "The only downside is that you can't update your model in the Linq to Sql designer anymore. But, why would you?"

LLBLGen Pro ASP.NET Dynamic Data Support

Frans' Dynamic Data and 3rd party o/r mappers is a fact post of May 1, 2008 describes how he convinced Scott Guthrie to open ASP.NET Dynamic Data products to third-party object/relational mapping (O/RM) tools, which in turn enables substituting LLBLGen Pro for LINQ to SQL or Entity Framework.

Steele Price Finds LINQ to SQL Frustrating

In his Some of my frustrations with Linq to Sql post of May 1, 2008, Steel Price complains about:

  • Duplication of the "one" object of a many:one association (such as a Customer for a new Order) with the InsertOnSubmit() method if the entity has both an ID field and association.
  • Lack of a method of assuring that deletions precede insertions with multiple updates to the DataContext.
  • Loading an Association does not automatically set the ID if that field is also in the map.

These are legitimate issues that the LINQ to SQL team should fix in VS 2008 SP1.

LINQ to SQLite Accepted as a Google Summer of Code Project

Kevin Kubasik, who wrote a fledgling LINQ to SQLite provider, reports in his Mono GSOC Projects: Linq to SQLite post of May 1, 2008 that he "noticed that one of the accepted proposals for the Mono project is to create a LINQ provider for SQLite."

This project appears to be related to the "Linq to SQL for open source databases" topic of Mono's Student Projects page and is listed in Current Projects on Google Code's Mono Project page.

An Open Source Project for a SQLMetal.exe and SQL Server Compact Edition 3.5 UI

LINQ to SQL's graphic designer doesn't support SQL Server Compact Edition (SSCE) 3.5, so you must use the SQLMetal.exe command-line tool to create LINQ to SQL classes for *.sdf database files.

J. Torres has started a open source project on CodePlex to create a front end for SQLMetal.exe that's compatible with SSCE 3.5.

However, it's a good bet that SSCE 3.5 support will be included in VS 2008 SP1, so the project might have a short shelf life.

Derek Whittaker Explains How to Group LINQ to SQL Sequences on Multiple Columns

Derek explains in his Multi-Column Grouping with Linq2Sql post of April 30, 2008 how to write the LINQ to SQL equivalent of the following T-SQL query.

SELECT  COUNT(*) AS Count,   
        cs.SendID,   
        cs.Name AS SendName,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress   
FROM    CampaignTrackingOpenedMail AS ctom   
        INNER JOIN CampaignTrackingSummary AS cts    
            ON ctom.CampaignTrackingSummaryID = cts.[ID]   
        INNER JOIN CampaignSend AS cs    
            ON cts.SendID = cs.SendID   
GROUP BY cs.SendID,   
        cs.Name,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress  

The translation isn't obvious.

Alex James Starts a Fantasy Football Project with Entity Framework as the Data Source

Back in late March, Alex published his Statement of Intent:

I'm going to start creating 'real world' applications using the Entity Framework, and I'm going to blog about all the tradeoffs I make, the hoops I have to jump through, the gotcha's I encounter, the workarounds, the design considerations etc.

In Real world App - Part 1 - Choosing an Application of April 30, 2008, Alex decides on Fantasy Soccer (a.k.a. Fantasy Football).

In Fantasy Soccer - Part 2 - an overview of the rules of May 1, 2008, Alex says:

At this stage only one thing is certain, it will use the Entity Framework for data access.

Fantasy Soccer - part 3 - Unit of Measure of May 3, 2008 discusses using the Entity Data Model's ComplexProperty feature to handle issues with English versus metric measurements and using a helper class to enable sorting by a scaled value, such as weight in lbs. or kg. (Stones for en-uk?>

Updated: May 3, 2008

The clip covers building a simple UI with a Django template that stores messages in the data store and retrieves text messages by author with a GQL query. The segment on deploying the app to GAE starts at about 08:25.

Note: GoogleDevelopers has 122 videos about Google Web services, et al., including the Campfire One release presentation. If you're new to Python and like video tutorials, ShowMeDo is the place to start. Joscha Feth's Google App Engine & eclipse (PyDev) post has fully illustrated instructions for getting code completion with Eclipse, PyDev, and the GAE working.

As time permits, I plan to determine whether GAE is a contender for "data store in the cloud" status and a viable competitor to SQL Server Data Services.

Added: 5/4/2008 12:30 PDT

Colin Meek: Composing LINQ to Entities Predicates

In his LINQ to Entities: Combining Predicates post of May 2, 2008, Colin offers three choices to compensate for LINQ's lack of an Or operator when composing predicates:

  1. Chain Unions instead of Where clauses, which is inefficient.
  2. Build the predicate by hand with ParameterExpression and Expression statements, which is a pain.
  3. Write a utility function called Compose() to implement LINQ to Entities-friendly And and Or builder methods by leveraging the ParameterRebinder implementation of Matt Warren's Expression Visitor from his IQuerable Providers series.

Interesting approach.

Added: 5/3/2008 11:45 PDT

Live Mesh and LINQ to Mesh Updates

Live Mesh Blog and Forum

The Live Mesh Blog has a detailed Behind Live Mesh: How we run cloud services post of April 30, 2008 by dev lead Alex Mallet.

Early Live Mesh adopters don't seem to have found the Live Mesh Forum. It had only 145 users as of May 3, 2008 10:00 PDT.

LINQ to Mesh (From Ori Amiga's Channel9 Video)

The Mesh Operating Environment (MOE) SDK currently has Silverlight, Javascript and desktop C# libraries. (The SDK also supports IronPython, as Ori demonstrated, but not VB.) Unfortunately, the Mesh team won't say when the SDK might be available, other than vague references to PDC 2008.

Here's the sample code for a LINQ to Mesh query against a Mesh object that Ori didn't attempt to execute because of a bug found earlier (~50:00):

Mesh mesh = Mesh.Load(new Uri(@"https://preview/mesh.com"), 
                new NetworkCredential("someone@somewhere.com", "Basic", myCred))

var meshQuery = from meshObject in mesh.CreateQuery<CoreObject>()
                where meshObject.Title == "title"
                orderby meshObject.Title
                select meshObject;

According to Ori at ~51:00, "the query processor can figure out three things:

  1. Which part of the query can execute most efficiently in our back-end storage using fine-grained indices in the cloud and execute that query as close to the data as possible.
  2. In our Mesh Operating Environment, we can keep on processing and linking and querying over that data to answer the question you're asking in the LINQ query.
  3. And you can query over the data in your local machine."

SSDS and Live Mesh

Jamie Thomson's SSDS and Mesh post of May 1, 2008 proposes using Live Mesh to sync SSDS data, perhaps even between two Authorities. Here's the story on potential SSDS and Live Mesh interop:

  • Pablo Castro and the Astoria team are working on a sync model for "Astoria Offline."
  • The SSDS team said they "will support the full EDM/EF/ADO.Net V3 model in due time."
  • Nigel Ellis demonstrated in his Introducing SQL Server Data Services session at MIX08 using the Sync Framework to synchronize vCard contact data between Microsoft Access 2007 and SSDS v1.
  • Francois Ajenstadt, director of project management for SQL Server, said "The goal is to bring the API's between SSDS and Astoria closer together closer to Release."
  • Ari Amiga says the Mesh team has been "working a lot with the Astoria team to make sure that our query syntax is the same, our URL syntax is the same, so it all looks nice and beautiful."
  • Astoria now uses, Mesh supports and SSDS will support the Atom Publication Protocol (AtomPub).

Added: 5/3/2008 10:30 PDT

ADO.NET Data Services Article in Visual Studio Magazine

My "Manipulate Data in the Cloud with ADO.NET [Data Services]" is the cover story for Visual Studio Magazine's May 2008 issue. Here's the deck:

ADO.NET Data Services (formerly code-named "Project Astoria") delivers data from relational tables and Windows Live services to Web mashups and Visual Studio 2008 projects, including ASP.NET AJAX and Silverlight 2.0 rich Internet applications, as Representational State Transfer (REST) resources over HTTP in response to URI-based requests or LINQ to REST queries.

Mesh Connection: At about 50:00 into the Ori Amiga: Programming the Mesh Channel 9 video segment of April 24, 2008 Ori mentions that the Mesh team is working with the Astoria folks to make sure their query and URL syntaxes are the same.

Related Topics: John Udell suggests taking advantage of Astoria's record-level URL addressability to implement loosely-coupled collaborative list-making in his Stonewall Farm, Darby Brook Farm, and the collaborative curation of data post of May 2, 2008. Because of its flexible entity feature (ad-hoc addition of attributes to an entity) SQL Server Data Services might be even a better choice when the SSDS team enables offering public read-only access to a container.

Moved: 5/3/2008 to Manipulate Data in the Cloud with ADO.NET [Data Services] due to length.

Kevin Hoffman Releases Continuous LINQ (CLINQ) v.1.1

According to Kevin's CLINQ v1.1.0.0 Released! post of May 2, 2008, CLINQ 1.1 now includes:

  • Support for Continuous Aggregation. Now, in addition to being able to have your result sets automatically update themselves in response to changes in the source set as well as changes to items in the source set, you can have aggregate scalar values that continuously update in the same fashion. The following is a list of the supported aggregation types that can now be done continuously:
    • Average
    • Min
    • Max
    • Sum
    • Standard Deviation
    • Count
  • Brand new demo application. This demo application not only shows off the power of continuous queries and WPF data binding, but also shows you how to use continuous aggregates, create your own continuous aggregates, and how to databind a WPF GUI to a continuous aggregate value.
His post has a screen shot of the Stock Monitor demo application in action.

Added: 5/2/2008 10:30 PDT

Jeff Currier Wants Questions to Address in SSDS Best Practices Tech*Ed Session

Jeff says in his Speaking at TechEd post of May 1, 2008:

I'm heading down to Orlando in a couple of weeks to give a talk about best practices when it comes to SSDS.  I'm working on my talk outline and was curious if there were any topics in particular that the community wanted to hear about in the talk?

I've posted my topics in a comment.

Jeff's session is "Best Practices in Building Applications with Microsoft SQL Server Data Services," which has the following description:

This interactive session provides a hands-on roadmap for developing and managing applications that use Microsoft SQL Server Data Services (SSDS), details best coding practices, and answers questions related to using on-demand storage services for business solutions.

This appears to be the sole SSDS session at Tech*Ed 2008.

Added: 5/2/2008 10:00 PDT

Popularity of SaaS/PaaS and Web Services/SOA Gain 1% Over 2006 According to McKinsey/Sandhill Survey

This 19-page Enterprise Software Customer Survey 2008 report by consultants McKinsey & Co. and Sandhill Partners finds that:

Innovation in the software industry is on the upswing, with Software as a Service (SaaS) being a key driver. The SaaS model is becoming mainstream and this has led to the rise of a new generation of SaaS platforms (also referred to in the industry as Platform as a Service – PaaS).

The distribution of 857 responses to "Please select the most important trend impacting your business" are shown in the following table for 2006 and 2008:

Most Important Trend, Percent 2006 2008
SaaS/SaaS or PaaS Platform 30 31
Web Services/Service Oriented Architecture 24 25
Open Source 10 8
Offshoring/Globalization 15 13
Software Industry Consolidation 17 7
Others 4 16

A detailed analysis of SaaS/PaaS platforms, which include "cloud computing" starts on page 5. Page 6 concludes:

The momentum toward adoption of SaaS platforms is surprising. Nearly three-quarters of the companies surveyed prefer to adopt platforms in at least one of the three archetypes we identify here.

For platform vendors, the only falloff in interest comes at the largest enterprises, those employing more than 25,000 people. In short, nearly every company – or division of a larger enterprise – is a customer or a prospect for SaaS platforms.

Exhibits on pages 6 - 9 provide additional details on interest in various models SaaS/PaaS models.

BEA's Understanding the Cloud Computing/SaaS/PaaS markets: a Map of the Players in the Industry post of May 2, 2008 by Peter Laird and Kent Dickson has clear definitions of cloud computing, SaaS, PaaS, and Core Cloud Services, as well as a map and list of major players with links to their sites.

Added: 5/2/2008 11:30 PST

SSDS Finally Provisioning Private Beta Users at a Faster Pace

KellyAlt says in Onboarding early beta customers of May 2, 2008:

Over the past 4 weeks, we have been onboarding customers slowly.  Since the response to our restricted beta invitation was quite overwhelming, quite a few of you will experience some delays in getting an account.  The SSDS team is doing everything possible to get you onboarded as soon as possible.  I am happy to say that I am seeing the pace pick up a bit over the last week.

I've been working with SSDS for about three weeks and have written a WinForm test harness to give SSDS v1 a thorough workout. Here's the UI when using the REST protocol to upload a Northwind Employee entity with a base64Binary-encoded bitmap:

Watch for my "Test-Drive SQL Server Data Services" feature article coming in the July 2008 issue of Visual Studio Magazine, which will include complete C# source code for the test harness.

Added: 5/2/2008 08:30 PDT

Ryan Dunn Interviews Tudor Toma and Soumitra Sangupta About the Business Value of SSDS

In Channel9's Tudor Toma and Soumitra Sengupta: SQL Server Data Services Business Value segment of May 1, 2008 (28:19):

Ryan sits down and talks with the Group Program Manager Tudor Toma and Architect Soumitra Sengupta about the business value of SSDS.

Added: 5/1/2008 17:00 PDT

David DeWinter Adapts T4 Templates to Generate T-SQL Stored Procedure Scripts for Entity Data Models

The Text Template Transformation Toolkit (commonly called T4) is a free Microsoft code generation engine for VS 2005 and later that supports their Domain Specific Languages and Software Factories toolkits. The Hilton Giesenow and Oleg Sych blogs have posts about T4.

David's Entity Framework Stored Procedure Generation post of April 26, 2008 describes the template:

The T4 template we created is designed to be a general purpose way to generate CUD procedures for an Entity Framework model. ...

The template not only generates EF-compliant sprocs, but it also considers only the tables that are in the SSDL of the model file. Unfortunately, the template must query the database (SQL Server 2005 only!) in order to make all the decisions necessary to create the output file. However, this is usually quite fast on generations other than the first one.

The template would have been a big time saver when I wrote 40+ stored procedures for my forthcoming book's test project.

Added: 5/1/2008 13:40 PDT

Rick Strahl Posts LINQ to SQL and WCF JSON/REST Samples from His ASP.NET Connections Presentations

Rick's ASP.NET Connections Slides and Samples Posted item of May 1, 2008 provides links to sample code and PowerPoint slides from his three presentations at the ASP.NET Connections conference in Orlando. Following are Rick's abstracts of the sessions:

Building a LINQ to SQL Business Layer for ASP.NET Applications

LINQ to SQL - although completely object based, is still little more than a sophisticated data access layer and so a business object layer is still needed to abstract business logic and provide common functionality that every business related entity requires. The business layer provides a few high level abstractions to the CRUD layer as well as a host of low level features that allow better control for low level data access in case LINQ to SQL queries are ill suited for queries and operations that cannot be performed with LINQ to SQL at all.

This session and its sample code is the culmination of Rick's extensive writing about LINQ to SQL in enterprise-grade projects.

WCF 3.5 JSON and REST Services

WCF 3.5's AJAX support has been made nearly as easy and comprehensive as ASMX functionality and there are many options of how data can be accessed over HTTP now with official protocol support for the webHttpBinding. This session starts of with examples of pure REST URLS and demonstrates features like URL templating, different response formats (wrapped, bare, XML, JSON) as well as the various different options for serving in this fashion. There are also examples of serving up raw data such as images or HTML content out of the REST based API. The remainder of the session focuses on AJAX functionality and explores different ways that WCF services can be called.

If you're interested in ADO.NET Data Objects, which support WCF JSON and REST protocols, don't miss this session.

Ajax Alternatives: Using jQuery with ASP.NET

Off-topic for this blog, but very interesting if you're into AJAX.

Note: Slides are the last file in the ZIP containers.

Frans Bouma Adds LINQ to SQL Refactoring and ASP.NET Dynamic Data Support to LLBLGen Pro

LLBLGen Pro has its own native LINQ implementation, but Frans announces in his Linq to Sql support added to LLBLGen Pro post of May 1, 2008 that latest version (2.6 beta) of LLBLGen Pro includes templates for generating LINQ to SQL classes and mapping (*.dbml) files.

This means you can use LLBLGen Pro's code generator to update your LINQ to SQL data model from SQL Server metadata automatically. Microsoft's LINQ to SQL implementation requires manually updating the data model for schema changes. (ADO.NET Entity Framework's Model Browser has an Update Model from Database context menu command.)

Frans says, "The only downside is that you can't update your model in the Linq to Sql designer anymore. But, why would you?"

LLBLGen Pro ASP.NET Dynamic Data Support

Frans' Dynamic Data and 3rd party o/r mappers is a fact post of May 1, 2008 describes how he convinced Scott Guthrie to open ASP.NET Dynamic Data products to third-party object/relational mapping (O/RM) tools, which in turn enables substituting LLBLGen Pro for LINQ to SQL or Entity Framework.

Steele Price Finds LINQ to SQL Frustrating

In his Some of my frustrations with Linq to Sql post of May 1, 2008, Steel Price complains about:

  • Duplication of the "one" object of a many:one association (such as a Customer for a new Order) with the InsertOnSubmit() method if the entity has both an ID field and association.
  • Lack of a method of assuring that deletions precede insertions with multiple updates to the DataContext.
  • Loading an Association does not automatically set the ID if that field is also in the map.

These are legitimate issues that the LINQ to SQL team should fix in VS 2008 SP1.

LINQ to SQLite Accepted as a Google Summer of Code Project

Kevin Kubasik, who wrote a fledgling LINQ to SQLite provider, reports in his Mono GSOC Projects: Linq to SQLite post of May 1, 2008 that he "noticed that one of the accepted proposals for the Mono project is to create a LINQ provider for SQLite."

This project appears to be related to the "Linq to SQL for open source databases" topic of Mono's Student Projects page and is listed in Current Projects on Google Code's Mono Project page.

An Open Source Project for a SQLMetal.exe and SQL Server Compact Edition 3.5 UI

LINQ to SQL's graphic designer doesn't support SQL Server Compact Edition (SSCE) 3.5, so you must use the SQLMetal.exe command-line tool to create LINQ to SQL classes for *.sdf database files.

J. Torres has started a open source project on CodePlex to create a front end for SQLMetal.exe that's compatible with SSCE 3.5.

However, it's a good bet that SSCE 3.5 support will be included in VS 2008 SP1, so the project might have a short shelf life.

Derek Whittaker Explains How to Group LINQ to SQL Sequences on Multiple Columns

Derek explains in his Multi-Column Grouping with Linq2Sql post of April 30, 2008 how to write the LINQ to SQL equivalent of the following T-SQL query.

SELECT  COUNT(*) AS Count,   
        cs.SendID,   
        cs.Name AS SendName,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress   
FROM    CampaignTrackingOpenedMail AS ctom   
        INNER JOIN CampaignTrackingSummary AS cts    
            ON ctom.CampaignTrackingSummaryID = cts.[ID]   
        INNER JOIN CampaignSend AS cs    
            ON cts.SendID = cs.SendID   
GROUP BY cs.SendID,   
        cs.Name,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress  

The translation isn't obvious.

Alex James Starts a Fantasy Football Project with Entity Framework as the Data Source

Back in late March, Alex published his Statement of Intent:

I'm going to start creating 'real world' applications using the Entity Framework, and I'm going to blog about all the tradeoffs I make, the hoops I have to jump through, the gotcha's I encounter, the workarounds, the design considerations etc.

In Real world App - Part 1 - Choosing an Application of April 30, 2008, Alex decides on Fantasy Soccer (a.k.a. Fantasy Football).

In Fantasy Soccer - Part 2 - an overview of the rules of May 1, 2008, Alex says:

At this stage only one thing is certain, it will use the Entity Framework for data access.

Fantasy Soccer - part 3 - Unit of Measure of May 3, 2008 discusses using the Entity Data Model's ComplexProperty feature to handle issues with English versus metric measurements and using a helper class to enable sorting by a scaled value, such as weight in lbs. or kg. (Stones for en-uk?>

Updated: May 3, 2008

The clip covers building a simple UI with a Django template that stores messages in the data store and retrieves text messages by author with a GQL query. The segment on deploying the app to GAE starts at about 08:25.

Note: GoogleDevelopers has 122 videos about Google Web services, et al., including the Campfire One release presentation. If you're new to Python and like video tutorials, ShowMeDo is the place to start. Joscha Feth's Google App Engine & eclipse (PyDev) post has fully illustrated instructions for getting code completion with Eclipse, PyDev, and the GAE working.

As time permits, I plan to determine whether GAE is a contender for "data store in the cloud" status and a viable competitor to SQL Server Data Services.

Added: 5/4/2008 12:30 PDT

Colin Meek: Composing LINQ to Entities Predicates

In his LINQ to Entities: Combining Predicates post of May 2, 2008, Colin offers three choices to compensate for LINQ's lack of an Or operator when composing predicates:

  1. Chain Unions instead of Where clauses, which is inefficient.
  2. Build the predicate by hand with ParameterExpression and Expression statements, which is a pain.
  3. Write a utility function called Compose() to implement LINQ to Entities-friendly And and Or builder methods by leveraging the ParameterRebinder implementation of Matt Warren's Expression Visitor from his IQuerable Providers series.

Interesting approach.

Added: 5/3/2008 11:45 PDT

Live Mesh and LINQ to Mesh Updates

Live Mesh Blog and Forum

The Live Mesh Blog has a detailed Behind Live Mesh: How we run cloud services post of April 30, 2008 by dev lead Alex Mallet.

Early Live Mesh adopters don't seem to have found the Live Mesh Forum. It had only 145 users as of May 3, 2008 10:00 PDT.

LINQ to Mesh (From Ori Amiga's Channel9 Video)

The Mesh Operating Environment (MOE) SDK currently has Silverlight, Javascript and desktop C# libraries. (The SDK also supports IronPython, as Ori demonstrated, but not VB.) Unfortunately, the Mesh team won't say when the SDK might be available, other than vague references to PDC 2008.

Here's the sample code for a LINQ to Mesh query against a Mesh object that Ori didn't attempt to execute because of a bug found earlier (~50:00):

Mesh mesh = Mesh.Load(new Uri(@"https://preview/mesh.com"), 
                new NetworkCredential("someone@somewhere.com", "Basic", myCred))

var meshQuery = from meshObject in mesh.CreateQuery<CoreObject>()
                where meshObject.Title == "title"
                orderby meshObject.Title
                select meshObject;

According to Ori at ~51:00, "the query processor can figure out three things:

  1. Which part of the query can execute most efficiently in our back-end storage using fine-grained indices in the cloud and execute that query as close to the data as possible.
  2. In our Mesh Operating Environment, we can keep on processing and linking and querying over that data to answer the question you're asking in the LINQ query.
  3. And you can query over the data in your local machine."

SSDS and Live Mesh

Jamie Thomson's SSDS and Mesh post of May 1, 2008 proposes using Live Mesh to sync SSDS data, perhaps even between two Authorities. Here's the story on potential SSDS and Live Mesh interop:

  • Pablo Castro and the Astoria team are working on a sync model for "Astoria Offline."
  • The SSDS team said they "will support the full EDM/EF/ADO.Net V3 model in due time."
  • Nigel Ellis demonstrated in his Introducing SQL Server Data Services session at MIX08 using the Sync Framework to synchronize vCard contact data between Microsoft Access 2007 and SSDS v1.
  • Francois Ajenstadt, director of project management for SQL Server, said "The goal is to bring the API's between SSDS and Astoria closer together closer to Release."
  • Ari Amiga says the Mesh team has been "working a lot with the Astoria team to make sure that our query syntax is the same, our URL syntax is the same, so it all looks nice and beautiful."
  • Astoria now uses, Mesh supports and SSDS will support the Atom Publication Protocol (AtomPub).

Added: 5/3/2008 10:30 PDT

ADO.NET Data Services Article in Visual Studio Magazine

My "Manipulate Data in the Cloud with ADO.NET [Data Services]" is the cover story for Visual Studio Magazine's May 2008 issue. Here's the deck:

ADO.NET Data Services (formerly code-named "Project Astoria") delivers data from relational tables and Windows Live services to Web mashups and Visual Studio 2008 projects, including ASP.NET AJAX and Silverlight 2.0 rich Internet applications, as Representational State Transfer (REST) resources over HTTP in response to URI-based requests or LINQ to REST queries.

Mesh Connection: At about 50:00 into the Ori Amiga: Programming the Mesh Channel 9 video segment of April 24, 2008 Ori mentions that the Mesh team is working with the Astoria folks to make sure their query and URL syntaxes are the same.

Related Topics: John Udell suggests taking advantage of Astoria's record-level URL addressability to implement loosely-coupled collaborative list-making in his Stonewall Farm, Darby Brook Farm, and the collaborative curation of data post of May 2, 2008. Because of its flexible entity feature (ad-hoc addition of attributes to an entity) SQL Server Data Services might be even a better choice when the SSDS team enables offering public read-only access to a container.

Moved: 5/3/2008 to Manipulate Data in the Cloud with ADO.NET [Data Services] due to length.

Kevin Hoffman Releases Continuous LINQ (CLINQ) v.1.1

According to Kevin's CLINQ v1.1.0.0 Released! post of May 2, 2008, CLINQ 1.1 now includes:

  • Support for Continuous Aggregation. Now, in addition to being able to have your result sets automatically update themselves in response to changes in the source set as well as changes to items in the source set, you can have aggregate scalar values that continuously update in the same fashion. The following is a list of the supported aggregation types that can now be done continuously:
    • Average
    • Min
    • Max
    • Sum
    • Standard Deviation
    • Count
  • Brand new demo application. This demo application not only shows off the power of continuous queries and WPF data binding, but also shows you how to use continuous aggregates, create your own continuous aggregates, and how to databind a WPF GUI to a continuous aggregate value.
His post has a screen shot of the Stock Monitor demo application in action.

Added: 5/2/2008 10:30 PDT

Jeff Currier Wants Questions to Address in SSDS Best Practices Tech*Ed Session

Jeff says in his Speaking at TechEd post of May 1, 2008:

I'm heading down to Orlando in a couple of weeks to give a talk about best practices when it comes to SSDS.  I'm working on my talk outline and was curious if there were any topics in particular that the community wanted to hear about in the talk?

I've posted my topics in a comment.

Jeff's session is "Best Practices in Building Applications with Microsoft SQL Server Data Services," which has the following description:

This interactive session provides a hands-on roadmap for developing and managing applications that use Microsoft SQL Server Data Services (SSDS), details best coding practices, and answers questions related to using on-demand storage services for business solutions.

This appears to be the sole SSDS session at Tech*Ed 2008.

Added: 5/2/2008 10:00 PDT

Popularity of SaaS/PaaS and Web Services/SOA Gain 1% Over 2006 According to McKinsey/Sandhill Survey

This 19-page Enterprise Software Customer Survey 2008 report by consultants McKinsey & Co. and Sandhill Partners finds that:

Innovation in the software industry is on the upswing, with Software as a Service (SaaS) being a key driver. The SaaS model is becoming mainstream and this has led to the rise of a new generation of SaaS platforms (also referred to in the industry as Platform as a Service – PaaS).

The distribution of 857 responses to "Please select the most important trend impacting your business" are shown in the following table for 2006 and 2008:

Most Important Trend, Percent 2006 2008
SaaS/SaaS or PaaS Platform 30 31
Web Services/Service Oriented Architecture 24 25
Open Source 10 8
Offshoring/Globalization 15 13
Software Industry Consolidation 17 7
Others 4 16

A detailed analysis of SaaS/PaaS platforms, which include "cloud computing" starts on page 5. Page 6 concludes:

The momentum toward adoption of SaaS platforms is surprising. Nearly three-quarters of the companies surveyed prefer to adopt platforms in at least one of the three archetypes we identify here.

For platform vendors, the only falloff in interest comes at the largest enterprises, those employing more than 25,000 people. In short, nearly every company – or division of a larger enterprise – is a customer or a prospect for SaaS platforms.

Exhibits on pages 6 - 9 provide additional details on interest in various models SaaS/PaaS models.

BEA's Understanding the Cloud Computing/SaaS/PaaS markets: a Map of the Players in the Industry post of May 2, 2008 by Peter Laird and Kent Dickson has clear definitions of cloud computing, SaaS, PaaS, and Core Cloud Services, as well as a map and list of major players with links to their sites.

Added: 5/2/2008 11:30 PST

SSDS Finally Provisioning Private Beta Users at a Faster Pace

KellyAlt says in Onboarding early beta customers of May 2, 2008:

Over the past 4 weeks, we have been onboarding customers slowly.  Since the response to our restricted beta invitation was quite overwhelming, quite a few of you will experience some delays in getting an account.  The SSDS team is doing everything possible to get you onboarded as soon as possible.  I am happy to say that I am seeing the pace pick up a bit over the last week.

I've been working with SSDS for about three weeks and have written a WinForm test harness to give SSDS v1 a thorough workout. Here's the UI when using the REST protocol to upload a Northwind Employee entity with a base64Binary-encoded bitmap:

Watch for my "Test-Drive SQL Server Data Services" feature article coming in the July 2008 issue of Visual Studio Magazine, which will include complete C# source code for the test harness.

Added: 5/2/2008 08:30 PDT

Ryan Dunn Interviews Tudor Toma and Soumitra Sangupta About the Business Value of SSDS

In Channel9's Tudor Toma and Soumitra Sengupta: SQL Server Data Services Business Value segment of May 1, 2008 (28:19):

Ryan sits down and talks with the Group Program Manager Tudor Toma and Architect Soumitra Sengupta about the business value of SSDS.

Added: 5/1/2008 17:00 PDT

David DeWinter Adapts T4 Templates to Generate T-SQL Stored Procedure Scripts for Entity Data Models

The Text Template Transformation Toolkit (commonly called T4) is a free Microsoft code generation engine for VS 2005 and later that supports their Domain Specific Languages and Software Factories toolkits. The Hilton Giesenow and Oleg Sych blogs have posts about T4.

David's Entity Framework Stored Procedure Generation post of April 26, 2008 describes the template:

The T4 template we created is designed to be a general purpose way to generate CUD procedures for an Entity Framework model. ...

The template not only generates EF-compliant sprocs, but it also considers only the tables that are in the SSDL of the model file. Unfortunately, the template must query the database (SQL Server 2005 only!) in order to make all the decisions necessary to create the output file. However, this is usually quite fast on generations other than the first one.

The template would have been a big time saver when I wrote 40+ stored procedures for my forthcoming book's test project.

Added: 5/1/2008 13:40 PDT

Rick Strahl Posts LINQ to SQL and WCF JSON/REST Samples from His ASP.NET Connections Presentations

Rick's ASP.NET Connections Slides and Samples Posted item of May 1, 2008 provides links to sample code and PowerPoint slides from his three presentations at the ASP.NET Connections conference in Orlando. Following are Rick's abstracts of the sessions:

Building a LINQ to SQL Business Layer for ASP.NET Applications

LINQ to SQL - although completely object based, is still little more than a sophisticated data access layer and so a business object layer is still needed to abstract business logic and provide common functionality that every business related entity requires. The business layer provides a few high level abstractions to the CRUD layer as well as a host of low level features that allow better control for low level data access in case LINQ to SQL queries are ill suited for queries and operations that cannot be performed with LINQ to SQL at all.

This session and its sample code is the culmination of Rick's extensive writing about LINQ to SQL in enterprise-grade projects.

WCF 3.5 JSON and REST Services

WCF 3.5's AJAX support has been made nearly as easy and comprehensive as ASMX functionality and there are many options of how data can be accessed over HTTP now with official protocol support for the webHttpBinding. This session starts of with examples of pure REST URLS and demonstrates features like URL templating, different response formats (wrapped, bare, XML, JSON) as well as the various different options for serving in this fashion. There are also examples of serving up raw data such as images or HTML content out of the REST based API. The remainder of the session focuses on AJAX functionality and explores different ways that WCF services can be called.

If you're interested in ADO.NET Data Objects, which support WCF JSON and REST protocols, don't miss this session.

Ajax Alternatives: Using jQuery with ASP.NET

Off-topic for this blog, but very interesting if you're into AJAX.

Note: Slides are the last file in the ZIP containers.

Frans Bouma Adds LINQ to SQL Refactoring and ASP.NET Dynamic Data Support to LLBLGen Pro

LLBLGen Pro has its own native LINQ implementation, but Frans announces in his Linq to Sql support added to LLBLGen Pro post of May 1, 2008 that latest version (2.6 beta) of LLBLGen Pro includes templates for generating LINQ to SQL classes and mapping (*.dbml) files.

This means you can use LLBLGen Pro's code generator to update your LINQ to SQL data model from SQL Server metadata automatically. Microsoft's LINQ to SQL implementation requires manually updating the data model for schema changes. (ADO.NET Entity Framework's Model Browser has an Update Model from Database context menu command.)

Frans says, "The only downside is that you can't update your model in the Linq to Sql designer anymore. But, why would you?"

LLBLGen Pro ASP.NET Dynamic Data Support

Frans' Dynamic Data and 3rd party o/r mappers is a fact post of May 1, 2008 describes how he convinced Scott Guthrie to open ASP.NET Dynamic Data products to third-party object/relational mapping (O/RM) tools, which in turn enables substituting LLBLGen Pro for LINQ to SQL or Entity Framework.

Steele Price Finds LINQ to SQL Frustrating

In his Some of my frustrations with Linq to Sql post of May 1, 2008, Steel Price complains about:

  • Duplication of the "one" object of a many:one association (such as a Customer for a new Order) with the InsertOnSubmit() method if the entity has both an ID field and association.
  • Lack of a method of assuring that deletions precede insertions with multiple updates to the DataContext.
  • Loading an Association does not automatically set the ID if that field is also in the map.

These are legitimate issues that the LINQ to SQL team should fix in VS 2008 SP1.

LINQ to SQLite Accepted as a Google Summer of Code Project

Kevin Kubasik, who wrote a fledgling LINQ to SQLite provider, reports in his Mono GSOC Projects: Linq to SQLite post of May 1, 2008 that he "noticed that one of the accepted proposals for the Mono project is to create a LINQ provider for SQLite."

This project appears to be related to the "Linq to SQL for open source databases" topic of Mono's Student Projects page and is listed in Current Projects on Google Code's Mono Project page.

An Open Source Project for a SQLMetal.exe and SQL Server Compact Edition 3.5 UI

LINQ to SQL's graphic designer doesn't support SQL Server Compact Edition (SSCE) 3.5, so you must use the SQLMetal.exe command-line tool to create LINQ to SQL classes for *.sdf database files.

J. Torres has started a open source project on CodePlex to create a front end for SQLMetal.exe that's compatible with SSCE 3.5.

However, it's a good bet that SSCE 3.5 support will be included in VS 2008 SP1, so the project might have a short shelf life.

Derek Whittaker Explains How to Group LINQ to SQL Sequences on Multiple Columns

Derek explains in his Multi-Column Grouping with Linq2Sql post of April 30, 2008 how to write the LINQ to SQL equivalent of the following T-SQL query.

SELECT  COUNT(*) AS Count,   
        cs.SendID,   
        cs.Name AS SendName,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress   
FROM    CampaignTrackingOpenedMail AS ctom   
        INNER JOIN CampaignTrackingSummary AS cts    
            ON ctom.CampaignTrackingSummaryID = cts.[ID]   
        INNER JOIN CampaignSend AS cs    
            ON cts.SendID = cs.SendID   
GROUP BY cs.SendID,   
        cs.Name,   
        cts.ListID,   
        cts.ListName,   
        ctom.EmailAddress  

The translation isn't obvious.

Alex James Starts a Fantasy Football Project with Entity Framework as the Data Source

Back in late March, Alex published his Statement of Intent:

I'm going to start creating 'real world' applications using the Entity Framework, and I'm going to blog about all the tradeoffs I make, the hoops I have to jump through, the gotcha's I encounter, the workarounds, the design considerations etc.

In Real world App - Part 1 - Choosing an Application of April 30, 2008, Alex decides on Fantasy Soccer (a.k.a. Fantasy Football).

In Fantasy Soccer - Part 2 - an overview of the rules of May 1, 2008, Alex says:

At this stage only one thing is certain, it will use the Entity Framework for data access.

Fantasy Soccer - part 3 - Unit of Measure of May 3, 2008 discusses using the Entity Data Model's ComplexProperty feature to handle issues with English versus metric measurements and using a helper class to enable sorting by a scaled value, such as weight in lbs. or kg. (Stones for en-uk?>

Updated: May 3, 2008

Saturday, May 03, 2008

Manipulate Data in the Cloud with ADO.NET [Data Services]

My "Manipulate Data in the Cloud with ADO.NET [Data Services]" is the cover story for Visual Studio Magazine's May 2008 issue. Here's the deck:

ADO.NET Data Services (formerly code-named "Project Astoria") delivers data from relational tables and Windows Live services to Web mashups and Visual Studio 2008 projects, including ASP.NET AJAX and Silverlight 2.0 rich Internet applications, as Representational State Transfer (REST) resources over HTTP in response to URI-based requests or LINQ to REST queries.

This architectural diagram of Astoria is Figure 1 of the story (click to read the caption):

Images courtesy of Redmond Media Group

You can download a sample NwindDataService.sln Web service app and the NwinDSClient.sln WinForm client that demonstrate Astoria's basic feature set:

Click image for full-size capture

Mesh Connection: At about 50:00 into the Ori Amiga: Programming the Mesh Channel 9 video segment of April 24, 2008 Ori mentions that the Mesh team is working with the Astoria folks to make sure their query and URL syntaxes are the same.

Related Topics: John Udell suggests taking advantage of Astoria's record-level URL addressability to implement loosely-coupled collaborative list-making in his Stonewall Farm, Darby Brook Farm, and the collaborative curation of data post of May 2, 2008. Because of its flexible entity feature (ad-hoc addition of attributes to an entity) SQL Server Data Services might be even a better choice when the SSDS team enables offering public read-only access to a container.

Moved 5/3/2008 from LINQ and Entity Framework Posts for 5/1/2008+.

Tuesday, April 29, 2008

LINQ and Entity Framework Posts for 4/28/2008+

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

Matt Davey: Investment Banking Needs PLINQ

In his Parallel Extensions to the .NET Framework article of April 23, 2008 for Dr. Dobbs Portal, financial services developer Matt Davey discusses Microsoft Research's Dryad Network and DryadLINQ and suggests using a C# 3.0 extension method to use PLINQ to submit work to a DigiPede Distributed Computing Network. Matt concludes:

Sitting in the financial vertical, PLINQ can't be released quickly enough. As long as banks understand the implications, PLINQ will improve the trading cycle. Microsoft, however, needs to continue to push in the concurrency field, making developers' lives easier by giving them access to cores locally as well as remotely, and ensuring that the development/debugger tools keep up with the library as it advances.

Added: 4/29/2008

Julie Lerman Creates an Extension Method to Visualize EntityStateObjects

Julie's An extension method for visualizing EntityStateObjects post of April 29, 2008 shows the design and provides the source code to simulate a debugger visualizer for the current EntityStateObject. The EntityStateObject isn't serializable, so she wrote an extension method with the DEBUG ContitionalAttribute to prevent it from appearing at runtime.

Bravo, Julie! And thanks for the source code.

Added: 4/29/2008

Rob Conery Implements a Repository+ Pattern by Passing Out an IQueryable<T>

Rob starts a controversy by redefining the Repository pattern to a Repository+, which outputs IQueryable<T>. With help from Oren Eini (Ayende Rahien), Rob adds a LazyList<IQueryable<T>> to provide lazy-loading generic list without relying on LINQ to SQL's built-in lazy loading feature.

He then goes on to discuss with John Galloway the use of HTML and CSS in ASP.NET MVC to create a UI for the project replacing tables with divs for layout.

Added: 4/29/2008

Randolph Cabral Continues His LINQ to SQL n-Tier Series

Exploring N-Tier Architecture with LINQ to SQL (Part 2 of n) of April 29, 2008 proposes wrapping a LINQ to SQL NorthwindDataContext object with a NorthwindBusinessContext to decouple the DataContext from the business layer and adds GetCustomerById() and PersistState() methods to more closely resemble the ActiveRecord pattern.

Added: 4/29/2008

Google Engineer Admits the App Engine Has Latency Problems Reading and Writing Datastore Entities

Perhaps apps running on the Google App Engine aren't as scalable as one might assume. According to Ken Ashcroft, a Google software engineer, who wrote Tips on Writing Scalable Apps of April 29, 2008:

    • Avoid contention on datastore entities. If every request to your app reads or writes a particular entity, latency will increase as your traffic goes up because reads and writes on a given entity are sequential. One example construct you should avoid at all costs is the gobal counter, i.e. an entity that keeps track of a count and is updated or read on every request. There are some interesting ways of simulating this behavior that don't require reads/writes on every request, and we'll talk about a handy way to cache entities for reads below.
    • Avoid large entity groups. Any two entities that share a common ancestor belong to the same entity groups. All writes to an entity group are sequential, so large entity groups can bog down popular apps quickly if there are a lot of writes to that group. Instead, use small, localized groups in your design.
    • Write sparingly. Writes are more expensive than reads; keep this in mind when designing your data model. If you can avoid a write--it's best to do so.

Added: 4/29/2008

Charlie Calvert Seeds the LINQFarm with an IEnumerable<T> Series

C# community evangelist Charlie Calvert starts another multipart LINQFarm series with LINQFarm: Understanding IEnumerable<T>, Part I, which (as you'd expect) covers the IEnumerable<T> interface.

The second member of the series promises to answer "What is it about IEnumerable<T> that makes it a useful data source and return type for LINQ to Objects queries?"

Added: 4/29/2008

Phil Wainewright Translates Steve Gillmor's Live Mesh Accolade

Phil's Gillmor: Why Google should worry about Live Mesh post of April 28, 2008 summarizes Steve's sometimes rambling 1,000+ words from his surprisingly effusive TechCrunch article, Microsoft Says Yes With Mesh of April 27:

Other commentators have dismissed Mesh as simply a mechanism to protect Microsoft’s desktop-bound assets, but Steve turns that around and points out that what Mesh is really about is connecting the desktop into the cloud (Meshing the desktop into the cloud, as I wrote last Thursday).

Call it self-serving if you like, but Microsoft needs a bridge that will carry its existing market presence over into the cloud and Mesh is that bridge. You could equally call it customer-friendly: Microsoft users will likely be pleased to have a mechanism that helps them make that transition without orphaning their desktop and on-premise IT assets.

Robert Scoble has a shorter translation in Mind Meshing with Steve Gillmor of April 27, 2008:

The only good excuse I’ve heard so far why Microsoft Mesh isn’t interesting is “I hate Microsoft.”

That’s a tough thing to overcome, but I thought Steve Gillmor was one of those who hated Microsoft too. After all, he bought a Mac and kept repeating on his blog “Office is dead.”

But, let’s translate Gillmor: Microsoft Mesh is fascinating. Agreed.

Steve didn't sound all that enthusiastic about Live Mesh during the Gillmor Gang's interview podcast with Dave Treadwell that I reported in the "Sync Guru (Rafik Robeal) Questions the Problems Live Mesh Will Solve" section of LINQ and Entity Framework Posts for 4/21/2008+.

Note: If you're wondering why Live Mesh is germane to the usual topics of this blog, it's because it includes a LINQ implementation ("LINQ to Mesh") and of the potential interaction of Live Mesh with ADO.NET Data Services and SQL Server Data Services (SSDS) as a primary data sources. (Updated 4/29/2008)

Update 4/29/2008: Ori Amiga attempts (but fails) to execute a LINQ to Mesh query against Mesh objects at 47:25 into the Ori Amiga: Programming the Mesh Channel 9 video segment of April 24, 2008. Starting at about 50:00, he shows the code for a typical LINQ query and mentions that the Mesh team is working with the Astoria folks to make sure their query and URL syntaxes are the same.

Other Channel9 videos about Live Mesh:

Bart DeSmet Follows Up on His TechDays Sessions on IQueryable

His Q: Is IQueryable the Right Choice for Me? post shows you how to:

[C]reate your own query pattern implementation by means of instance methods ... by providing an entry-point like Table<T> and further providing a fluent interface pattern that produces Query<T> objects in a chained manner.

as an alternative to implementing IQueryable<T>.

It's nice to see Bart returning to posts about LINQ.

Dinesh Kulkarni Has Resumed Posting about LINQ to SQL

After more than six months of silence following his move "I have moved to another project with the developer division at Microsoft (more about that on a sunny day)" reported in his LINQ to SQL: What is NOT in RTM (V1) post of October 15, 2007, Dinesh posted Lifetime of a LINQ to SQL DataContext on April 27, 2008.

Apparently the sun hasn't shone in Redmond since mid-October.

His latest post provides guidelines for answering the question of whether the DataContext should be short- or long-lived.

As I said in my comment: Welcome back!

Eugenio Pace Produces Screencast of LitwareHR Using SSDS

End to end demo of LitwareHR on SSDS provides an 11-minute screencast of LitwareHD using SQL Server Data Services instead of SQL Server 2005 as the back-end datastore. Eugenio divides the screencast into two acts:

    1. Tenant Provisioning and customization (takes the first 5 min approximately). I show the initial tenant provisioning (creation of a new tenant in LitwareHR, initial configuration, etc) and then a basic customization (e.g. look & feel, position entity shape, etc). You'll notice that I switch back and forth between www.litware.com and SSDS to show how entities look like in the store.
    2. Using the new created instance (this takes the last 6 min). I show a hypothetical recruiter logging-in, opening new positions, then an applicant browsing the open positions and submitting a Resume and finally the recruiter browsing the posted applications. Again, you'll see how do these entities look like in SSDS.

Here are Eugenio's introduction and six-part tutorial about moving LitwareHR to SSDS:

Barry Gervin Starts Yet Another Entity Framework Series

His kickoff, The Entity Framework vs. The Data Access Layer (Part 0: Introduction) of April 27, 2008, explores the roles of a data access layer (DAL, not necessarily a tier) and lays out questions related to it's implementation.

Barry promises that in Part I:

I'll explore the idea of the Entity Framework replacing my data access layer and evaluate how this choice rates against the various objectives above. I'll then continue to explore alternative implementations for a DAL using the Entity Framework.

Liam Cavanagh Offers Sync Framework Tutorials

In apparent response to the increased interest in data synchronization spiked by Live Mesh, Liam's New Sync Framework Tutorial of April 28, 2008 offers the following four projects:

  • Sync101 With Metadata Store – Demonstrates a basic provider for an in-memory data store (replica) that uses the SqlCeMetadataStore class to store the metadata in a SQL Server Compact Edition database.

  • Sync101 Refactored – Factors out the replica-specific code from the code common to any provider in preparation for the next step of adding an additional provider. Also uses a more flexible transfer mechanism class to allow accommodation of more complex schemas.

  • Sync101 Add Xml Provider – Adds a new provider that represents a data store comprised of XML files.

  • Sync101 Add Csv Provider – Adds a new provider that represents a data store containing Comma-Separated Values (CSV) files and also uses XML configuration files to specify the transfer mechanism class properties and the property mappings between providers.

You can download the source code from the MSDN CodeGallery.

Julie Lerman Unveils the Forthcoming ASP.NET EntityDataSource Control

Repeated from: LINQ and Entity Framework Posts for 4/21/2008+

Danny Simmons demonstrated the EntityDataSource control at the MVP Summit 2008 and Julie shares her notes in Sneak Peek at the EntityDataSource Control of April 27, 2008. The EntityDataSource control is the Entity Framework's answer to LINQ to SQL's LinqDataSource control for databinding ASP.NET GridView, ListView and other bindable server controls.

Two important EntityDataSource control features that Julie describes are:

Although I don't remember seeing it during the session, Danny did say that you can choose to eager load related data in the same way that you can with the Include method. I don't know how this is done or if it will impact updating, but I don't know why it would.

One of the most interesting things about the EntityDataSource is that along with its' ability to perform server side paging, it also performs client side caching - of current AND original data. The original data is not stored as complete objects, but the minimal data necessary to reconstruct state when it's time to update. Updates happen, like any other data source, one at a time. So you have to pick an item, edit it and update it.

Availability of the EntityDataSource control will enable ASP.NET Dynamic Data scaffolding to use EF as an alternative to LINQ to SQL as its data source. (See David Ebbo's Dynamic Data at MIX, and upcoming changes post of March 6, 2008.

Hopefully, the EntityDataControl won't share the problems with the LinqDataControl that Julie described in her January 22, 2008 Thinking about the EntityDataSource post.

Note: The link to the OakLeaf blog in the latter post goes to the home page. Julie might have intended to link to go to the Problems Using Stored Procedures for LINQ to SQL Data Retrieval (Updated) post of October 2, 2007. That post contains a "Problems with Stored Procedures That Affect ASP.NET Projects Only" section, which covers sorting and paging problems.

Sunday, April 27, 2008

LINQ and Entity Framework Posts for 4/21/2008+

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

Julie Lerman Unveils the Forthcoming ASP.NET EntityDataSource Control

Danny Simmons demonstrated the EntityDataSource control at the MVP Summit 2008 and Julie shares her notes in Sneak Peek at the EntityDataSource Control of April 27, 2008. The EntityDataSource control is the Entity Framework's answer to LINQ to SQL's LinqDataSource control for databinding ASP.NET GridView, ListView and other bindable server controls.

Two important EntityDataSource control features that Julie describes are:

Although I don't remember seeing it during the session, Danny did say that you can choose to eager load related data in the same way that you can with the Include method. I don't know how this is done or if it will impact updating, but I don't know why it would.

One of the most interesting things about the EntityDataSource is that along with its' ability to perform server side paging, it also performs client side caching - of current AND original data. The original data is not stored as complete objects, but the minimal data necessary to reconstruct state when it's time to update. Updates happen, like any other data source, one at a time. So you have to pick an item, edit it and update it.

Availability of the EntityDataSource control will enable ASP.NET Dynamic Data scaffolding to use EF as an alternative to LINQ to SQL as its data source. (See David Ebbo's Dynamic Data at MIX, and upcoming changes post of March 6, 2008.

Hopefully, the EntityDataControl won't share the problems with the LinqDataControl that Julie described in her January 22, 2008 Thinking about the EntityDataSource post.

Note: The link to the OakLeaf blog in the latter post goes to the home page. Julie might have intended to link to go to the Problems Using Stored Procedures for LINQ to SQL Data Retrieval (Updated) post of October 2, 2007. That post contains a "Problems with Stored Procedures That Affect ASP.NET Projects Only" section, which covers sorting and paging problems.

Added: April 27, 2008

Jeremy Miller Reports on the MVP Summit 2008: Still Not Thrilled with the Entity Framework

The NHibernate Mafia weren't fighting the Persistence Ignorance battle at this year's MVP Summit, but Jeremy still isn't happy about the current (Beta 3) Entity Framework (EF) implementation. He says in A Train of Thought -- MVP Summit 2008 Edition of April 23, 2008:

    • I'm still not thrilled with the Entity Framework and the direction they locked themselves into, but the EF team came prepared to talk about some compromises that might start pushing EF into the usable category for me. I honestly wouldn't care about the EF, but I'll probably be back in consulting at some point in the next 5 years at a shop that will only use Microsoft tooling.
    • Daniel Simmons gets the "Thickest Skin of the Year" award. Not the Hyperion/Endymion Dan Simmons though.

Apparently the NH-Mafia worked Danny over again on EF issues.

In the "What I want for Christmas from Redmond" department, Jeremy's wish list includes:

    • Transparent lazy loading in the Entity Framework. If they want the Entity Framework to be usable in constructing rich Domain Models, they're going to have to do this.

EF enables lazy loading by default, but requires invoking the Load() method to retrieve the associated objects form the server. As Danny Simmons says in item 11. Lazy Load and Eager Load of his Entity Framework FAQ (updated 1/4/2008):

The entity framework attempts to make everything explicit, so even with lazy loading, you must explicitly call the Load method on the relationship in order to load its related entities. That way you know exactly when round trips are made to the database. As systems grow larger and more complex, this kind of explicitness can do a lot to improve overall supportability of the system.

I'm fine with calling Load(). Most of my projects involve multiple tiers, stored procedures, or both, so I ordinarily use eager loading by invoking Attach() with a filter to control depth, as Danny described in his Filtered association loading and re-creating an entity graph across a web service boundary... post of December 21, 2007.

Added: April 26, 2008

Colin Meek Elaborates on Generating Dynamic LINQ Expressions

Colin presented "VMS307: Visual Studio 2008: LINQ Deep Dive and Best Practices" at DevConn 2008 Orlando. His Using LINQ Expressions to Generate Dynamic Methods post extends his session's discussion of the ADO.NET Entity Framework Extension that "materializes  arbitrary CLR types given a data reader or DB command." Colin says:

The System.Linq.Expressions API serves a specific need for integrated queries: it allows the compiler to describe the user’s code as a data structure that can then be translated to targets other than MSIL at runtime, like SQL, Web Services, etc. Expressions can also be compiled into delegates at runtime, which brings me to a .NET 3.5 solution to the default shaper problem… If the compiler can use expressions to describe code, so can we!

Added: April 26, 2008

Rafik Robeal on Local Storage and Synchronization in HTML 5

HTML5 - The Offline Web of April 25, 2008 observes that HTML 5 will contain APIs for persistent storage in key/value and SQL databases and for offline Web applications. Rafik observes:

Isn’t interesting that despite the current networking revolution people are building the next web to work offline!? It is not strange to me but for many people this is bizarre. ...

To me, offline is an experience and programming model. Offline experience is all about richness, responsiveness, and better use of the data pipe. An offline programming model is what I’ve been showing people with Sync Services.

It's obvious that Ray Ozzie and Dave Treadwell share Rafik's enthusiasm for synchronization.

Added: April 26, 2008

Beth Massi Explains How to Query HTML with LINQ to XML

Beth's Querying HTML with LINQ to XML post of April 25, 2008 shows you how to use LINQ to XML to query HTML pages by removing markup entities, such as &nbsp;, that cause the document to be malformed by XML standards.

Added: April 26, 2008

Pat Helland to Present at UC Berkeley's Tribute to Honor Jim Gray

Pat Helland, an architect on the Visual Studio team, will give the "Jim as a Mentor: Colleagues" presentation at the University of California Berkeley's Tribute to Honor Jim Gray. Pat, who worked with Jim Gray at Tandem Computers in the 1980s, announced in his Knowledge and Wisdom -- A Tribute to Jim Gray post of April 25, 2008 that his two-page paper for a special edition of the SIGMOD Record is available for download. The paper summarizes Pat's "experiences with Jim's approach to nurturing and mentoring."

From the press release for the Tribute:

Three organizations dedicated to the advancement of computing science, IEEE Computer Society, ACM, and UC Berkeley, today announced they will join the family and colleagues of Jim Gray in hosting a tribute to the legendary computer science pioneer, missing at sea since Jan. 28, 2007.

The tribute will be held May 31 at UC Berkeley’s Zellerbach Hall. The general session will be from 9-10:30 a.m., followed by technical sessions that will require registration. Registration and other information can be found at: http://www.eecs.berkeley.edu/ipro/jimgraytribute

You can learn more about Jim Gray's mysterious disappearance at sea of and the search for him from these two contemporaneous OakLeaf posts: U.S. Coast Guard Searching for Jim Gray off San Francisco Coast of January 29, 2008 and "Friends of Jim" Halt Volunteer Search for Jim Gray of February 17, 2007.

Added: April 26, 2008

Eugenio Pace Implements a Simple Unit of Work Pattern for SSDS

SQL Server Data Services don't support client-side transactions, so implementing the Unit of Work pattern requires compensating actions in the event one element of multiple related updates fails after previous actions have succeeded.

Eugenio's LitwareHR on SSDS - Part VI - Unit of Work support post of April 25, 2008 describes how he modified his Repository class for the LitwareHR application to implement a simple version of the Unit of Work pattern.

Added: April 25, 2008

Sync Guru (Rafik Robeal) Questions the Problems Live Mesh Will Solve

Rafik Robeal was the technical driving force behind ADO.NET Sync Services, which is now part of the Microsoft Synchronization Framework, in turn a component of the Microsoft's new Live Mesh project. Rafik's moved on to mobile development, but his The Mesh – A New Synchronization Backbone post of April 24, 2008 asks the same questions I've been pondering:

[W]hat is the key problem that Live Mesh is trying to solve?

  1. Is it remote access? ...
  2. Is it data sharing? ...
  3. Is it data collaboration? ...
  4. Is it data synchronization platform? ...

Rafik believes it's basically #3 and #4 for consumers. I've got access to the Live Mesh Technology Preview, but both Rafik and I are waiting for the Live Mesh SDK to learn more about its API and data models.

My initial answer to Rafik's question is loss of developer mindshare and potential platform lock-in to Platforms as a Service (Paas) from Google, Amazon, Adobe and, perhaps, SalesForce.

Podcast: For more details about Microsoft's plans for Live Mesh from David Treadwell, corporate vice president of Microsoft's Live Platform Services and the exec behind SQL Server Data Service (SSDS) deployment as a Live Platform, read Dan Farber's Live Meshing on the Gillmor Gang post of April 25, 2008 and the Gillmor Gang's interview podcast.

Mary Jo Foley's Ten things to know about Microsoft’s Live Mesh of April 22, 2008 provides additional Live Mesh background.

Added: April 25, 2008

Doug Rothaus Performs Identity Transforms with LINQ to XML's ReplaceWith() Method

Doug demonstrates replacing an <eEmail> element with an <a href="mailto:" & eMailAddress ... >... element by using VB's XML literals and LINQ to XML's ReplaceWith() method in his VB XML Cookbook, Recipe 3: Identity Transforms (Doug Rothaus) post of April 25, 2008. A relatively simple pair of VB functions make a substitution that would require a significantly more lengthy XSLT transform.

Added: April 25, 2008

Mike Flasko: Astoria Team Targeting Silverlight 2.0 Beta 2 for REST Services

In the Astoria Team's Using REST Services in Silverlight post of April 24, 2008, Mike Flasko says:

[W]e are targeting Beta 2 of the Silverlight SDK (no dates to announce for this just yet) to have a version of the client library for ADO.NET Data Services. Given that we use many of the core pieces of Silverlight to enable data service interaction, we've waited for those to come into the platform so that we can start to round out our Silverlight experience. 

The scenarios we're looking to enable in Beta 2 are: the ability to send async queries, inserts, updates and deletes for same domain requests.  We're still working through how we'll enable these types of requests in cross domain scenarios.

I believe most of us were expecting an Astoria CTP for Silverlight 2.0 Beta 1 at the end of April, along with Beta 4 or a post-Beta 3 CTP of the Entity Framework. Doesn't look that way now, at least for Silverlight.

Added: April 24, 2008

Randolph Cabral Starts Exploring N-Tier Architecture with LINQ to SQL Series

Randy's Part 1 - Analyzing LINQ to SQL Entities post of April 23, 2008 follows up his earlier Active Record Vs. Unit of Work analysis of April 3 with an attempt to "marry" the Active Record and Unit of Work patterns with LINQ to SQL's DataContext.

He promises:

In the next post, we’ll take a look at the DataContext class and evaluate how we could best take advantage of its object tracking capabilities.  I’ll also explore writing a context manager class that helps ease the pains in dealing with the DataContext.

Added: April 24, 2008

Eric White Posts Second Edition of His Functional Programming Tutorial for LINQ Queries

Query Composition using Functional Programming Techniques in C# 3.0 of April 23, 2008 is Eric's 34-part rewrite of his original 2006 version. Eric says:

As with the previous tutorial, I've targeted this tutorial to C# developers who have no functional programming experience, i.e. the typical object-oriented coder.

One thing that I want to say at this point: This stuff is easy. It's also really fun. You don't have to read academic papers to learn about, enjoy, and benefit from functional programming in C# 3.0. There are about half a dozen concepts you need to learn, each one easy. Concepts like just a new way to write a method (that has no name), or a new way to write a static method for a class. Then you put them all together, and the result is more than the sum of the parts.

As you might expect, based on Eric's day job as an Open XML technical evangelist, he "shows you how to write code to extract the text of paragraphs of an Open XML document, along with the associated style of each paragraph."

Added: April 24, 2008

Jean-Paul Boodhoo Argues His Preference for var with Meaningful Variable Names

J-P says in his Got var? post of April 22, 2008:

As I strive toward more readable, intent revealing code, I find myself looking at the intent behind the usage of the variable coupled with a meaningful name, vs the actual type. In reality, I find the the argument to not use var is a moot point in a static environment that provides you with all the information you need once you hit the "."

His IList<Customer> listOfCustomers = new List<Customer>() example looks a lot like VB's and Access VBA's Hungarian notation that I spent 15 years writing.

Be sure to read the comments.

Added: April 24, 2008

Scott Hunter: New Refresh of Dynamic Data Runtime and Tools is Posted

The headline says it all. Sample code that's updated to work with the latest runtime is also available from the Code Gallery. The new Runtime and Tools drop includes (incomplete) documentation in CHM format.

Added: April 24, 2008

Pablo Castro Analyzes RESTful Optimistic Concurrency Management for Astoria with HTTP 1.1 Entity Tags

Pablo's Optimistic Concurrency & Data Services post of April 22, 2008 describes how HTTP 1.1 entity tags (ETags) can be used to detect whether a server resource has changed before accepting a client modification. The client keeps a copy of "opaque data," such as a version number or timestamp obtained from the server by a GET request. The client submits it in an if-match request header with its HTTP PUT or DELETE request. A failed match returns a 412 "Precondition Failed" status code to the client. Clients can override the match requirement by substituting an asterisk (*) for the opaque data.

ETags in the request header work for single entities; for collections, the plan is to add the ETag as metadata <entry m:type= "someType" m:etag="someValue" ...> to AtomPub and and in JSON's "__metadata" property.

Pablo observes a fly in the ointment: the definition of "strong" and "weak" eTags in section 13.3.3, "Weak and Strong Validators," of RFC 2616 - Hypertext Transfer Protocol - HTTP 1.1. HTTP 1.1 lets validation values remain unchanged when "no significant change in semantics" occurs. Weak TAGS apply only to GET operations, not PUT and DELETE, where he wants to use them.

P.S.: In a post of the same date to his personal blog, The Astoria team is hiring!, Pablo notes that the Astoria team is "looking for folks for Development, Quality Assurance and Program Management positions." It's likely that the team is staffing up to take on the challenge of aligning ADO.NET Data Services and the Entity Data Model (EDM) with SQL Server Data Sources (SSDS).

Eugenio Pace Takes the Complexity Out of SSDS Cross-Container Queries with .NET Parallel Extensions

In his More on parallel queries across containers in SSDS post of April 22, 2008, Eugenio shows the original code he used to implement the CrossContainerSearch() method he described in his earlier LitwareHR on SSDS - Part V - Searching across Containers post.

In this post, he finds that the scheduling, join and state management operations can all be handled by the .NET Parallel Extensions' Parallel.For() method, which greatly simplifies the code.

Eric White Creates a GroupAdjacent LINQ Query Operator for OpenXML Documents and LINQ to XML

Eric notes in his The GroupAdjacent Query Operator Extension Method post of April 20, 2008 that:

Quite often when you are processing an Open XML document using LINQ to XML, you want to group adjacent paragraphs that have the same style.

Let's say that the above array represents paragraphs in a document.  If the value is > 0, the paragraphs are a heading of the specified level.  The zeros represent paragraphs styled as normal.  We want to do some processing on the collection of paragraphs in such a way that we process all adjacent paragraphs of the same style in a single query.  We could group them, and execute a query on each group, but as you saw above, the standard GroupBy extension method will group all of the 0's together and all of the 2's together.

Given this array: int[] ia = new int[] { 1, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0 };

GroupAdjacent groups them like this: In contrast, the standard GroupBy method groups them like this:
Group 1
1
Group 0
0
0
Group 2
2
Group 0
0
0
0
Group 2
2
Group 0
0
0
0
Group 1
1
Group 0
0
0
0
0
0
0
0
0
Group 2
2
2

I believe the GroupAdjacent() query operator will prove quite useful for general LINQ to XML processing, not just OOXML work.

Rob Conery Deep Dives into LINQ to SQL Data Access for his MVC Storefront Project

Rob continues the Webcasts of his ASP.NET MVC Storefront project in ASP.NET MVC: MVC Storefront, Part 4 of April 21, 2008:

In this webcast I dive pretty deep into Data Access and talk about some architectural decisions I need to make, specifically how to get LINQ To SQL to map to my model properly. ...

Steven Harman suggested I run a Spike (a quick prototyping exercise to test out a theory) to make sure that my data access strategy will work with an actual database. Good idea.

I quickly ran into some issues with LINQ To SQL, but found some neat ways to keep things clean and tidy so I don't explode my database all over my happy little application.

Previous episodes are:

Update April 24, 2008: Rob's ASP.NET MVC: MVC Storefront, Part 5 covers globalization issues.

Scott Hanselman Interviews Scott Hunter About ASP.NET Dynamic Data

Scott Hunter is a program manager on the ASP.NET Dynamic Data team. The Hanselminutes podcast is at <ASP.NET Dynamic Data with Scott Hunter/>.

Matthew Hunter Continues Improvements to his LINQ to SQL Entity Base Implementation

Matt describes these improvements:

  1. There is no longer need to have a timestamp field
  2. Option to keep original entity values.

to his LINQ to SQL Entity Base implementation in his Improvement: No requirement for timestamp column any longer post of April 23, 2008.

Thursday, April 17, 2008

LINQ and Entity Framework Posts for 4/14/2008+

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

Updated: 4/20/2008

Latency and Service Level Agreement Sections Added to Comparison of Online Databases

Data latency and eventual consistency are known problem issues Amazon SimpleDB, might be an issue with Google App Engine's Bigtable-based Datastore, and probably won't be a problem with SQL Server Data Services. None of the three beta "datastores in the cloud" services offer a Service Level Agreement (SLA) at present, but Microsoft claims that data backups are stored in each cluster, and geo-redundant data copies provide disaster recovery.

Read more about these features in Comparing Google App Engine, Amazon SimpleDB and Microsoft SQL Server Data Services.

Added: 4/19/2008

David Hayden Walks Through the New ASP.NET Dynamic Data Wizard

Scott Guthrie's "Visual Studio Dynamic Data Project Wizard" topic from his ASP.NET MVC Source Refresh Preview post of April 16, 2008 gives a brief introduction of the enhanced Dynamic Data Wizard that generates the LINQ to SQL partial classes and DataContext code for highly customized template pages that include selectable INSERT/UPDATE/DELETE UIs.

Dave's ASP.NET Dynamic Data Wizard - Generating LINQ To SQL Data Model and Custom Pages post of April 19, 2008 goes Scott one better with a fully illustrated and highly detailed Wizard walkthrough.

Added: 4/19/2008

Aral Balkan's GAE SWF Project Demonstrates Flash and Flex on Google App Engine

Aral's The GAE SWF Project is a simple Google App Engine application that uses a Flash form to save individual user profiles in GAE's Datastore. The form uses the Users API, DataStore API, and Mail API to log the user in with his or her Google account, create a new login, and save the data in the Datastore, and log the user in automatically on return. As a plus, Aral includes code from his Make Flash obey text size changes post.

The demo also proves that it is possible to create simple, utilitarian Web components with Flash and Flex.

Update 4/20/2008: Aral notes in his The GAE SWF Project 1.21 post that he updated The GAE SWF Project to version 1.21 on April 20, 2008.

Added: 4/19/2008

Updated Version of Visual LINQ (VLINQ) Query Builder Project Available with Source Code

Microsoft France's add-in for Visual Studio helps you to visually build LINQ to SQL queries with a process similar to the Access query builder. This new version, posted to CodePlex on April 17, 2008 and updated April 18, includes a fix for an installer bug and delivers full source code.

Added: 4/19/2008

Rick Strahl Suggests Using LINQPad as a Code Snippet Execution Engine

Rick says in his LINQPad as a Code Snippet Execution Engine post of April 17, 2008:

LINQPad does a great job at LINQ execution and visualization, but it has a lot more uses than just a LINQ query tool. It's basically a snippet editor that allows you to save snippets and more importantly, execute just about any code that you can write as an expression or single function block . You can execute both Expressions which is a single command that returns a result or a single block of commands or a Statement which is a block of commands in a single execution block (essentially what would amount to a method body).

It's awesome if you just want to very quickly verify how some .NET function or expression  works without having to write a test, console output routine or change your code and run it with the debugger.

Added: 4/17/2008

Ruurd Boeke Wraps Up His n-Tier Entity Framework Implementation

His latest New sample application for disconnected n-tier EntityFramework objects of April 16, 2008 is an MVC client for the April 7, 2008 version the Disconnected N-Tier objects using EntityFramework project, which Ruurd describes as:

[A] sample application that uses a server to retrieve data with EF and a client that is totally unaware of EF. Changes on the client are changetracked and serialized in a pretty xml format. Then, the server attaches to the graph and is able to use a context to save changes.

The MVC client is based on Microsoft patterns & practices' new Prism framework for developing composite Windows Presentation Foundation (WPF) applications. The Prism group describes their framework as:

"Prism" addresses the challenges around building complex enterprise WPF applications. As complexity increases and teams grow, applications become increasingly difficult to maintain. Using "Prism" enables designing a composite application that is composed of many discrete, loosely coupled modules. These modules can be developed, tested and deployed by separate teams.

Source code for Ruurd's project is available from CodePlex.

Added: 4/17/2008

Beth Massi Continues her LINQ to SQL n-Tier Smart Client Project

Beth's LINQ to SQL N-Tier Smart Client - Part 3 Database Transactions of April 16, 2008 aggregates INSERT, UPDATE, and DELETE operations on a previously disconnected DataContext into a single explicit transaction.

Following are links to Parts 1 and 2:

Added: 4/17/2008

Kevin Hoffman Adds Continuous Aggregation (Including VWAP) to CLINQ

Kevin's been working on Continuous LINQ (CLINQ) again, as evidenced by his CLINQ v1.1 - Extending the AggregateViewAdapter to Create Continuous VWAP post of April 16, 2008 and the first two posts below. His latest post describe improvements to v1.1 to include Volume-Weighted Average Prices (VWAP), a means of normalizing historical stock prices by taking into account the number of shares traded at a given price.

Source code is available on CodePlex.

CLINQ is similar in concept to LINQ to Streams (SLINQ or Streaming LINQ) by Oren Novotny, which is described in Third-Party LINQ Providers of March 27, 2007, last updated 8/7/2007. Looks like it's time to do another third-party LINQ provider update.

Added: 4/17/2008

Lack of SSL Support Nullifies Google App Engine as a Web Data Store

According to Google's Marzia in an April 10, 2008 message to the Google App Engine (GAE) group, "Please keep in mind when designing any system that Google App Engine does not currently provide SSL support for your domain." There are indications in another GAE group thread that the premium (paid) version will support SSL.

Failure to support SSL is a major obstacle to GAE's adoption for commercial applications. Google must confirm that the premium version will support SSL before professional developers can  justify devoting resources to this service.

For more details, see the Comparing Google App Engine, Amazon SimpleDB and Microsoft SQL Server Data Services post of April 9, 2008 (updated April 15, 2008).

Thanks to Filip Verhaeghe for the heads up in an April 15, 2008 comment to the preceding post on this issue.

Pablo Castro: ADO.NET and SQL Server Data Services to Converge

Pablo's Astoria Online Service --> SQL Server Data Services post of April 14, 2008 outlines plans to harmonize standards for on-premise ADO.NET Data Services and Microsoft-hosted SQL Server Data Services.

As part of our unified Data Services vision, we will provide a solution that enables seamless integration between on-promise deployments (software) and cloud based deployments (services). 

We’re working on aligning aspects of SSDS and Astoria and this alignment will come over a series of updates to both Astoria and SSDS. For example, we will likely add AtomPub and JSON support to SSDS to match the results encoding of Astoria and are already working on extensions to EDM to incorporate the open content model of SSDS.

We’ll be working to extend Astoria as needed to ensure it provides a great development experience over the SSDS service. It’s also worth noting how the Microsoft Sync Framework can be used to tie multiple deployments together – Nigel covers this in his talk. Stay tuned for more details.

Extending the EDM to cover SSDS's free-form "open content model," including "flexible entities" doesn't appear to me to be a piece of cake.

New LINQ to CSV Library on CodeProject

Matt Perdeck claims the following features for his LINQ to CSV library posted April 10, 2008:

  • Follows the most common rules for CSV files. Correctly handles data fields that contain commas and line breaks.
  • In addition to comma, most delimiting characters can be used, including tab for tab delimited fields.
  • Can be used with an IEnumarable of an anonymous class - which is often returned by a LINQ query.
  • Supports deferred reading.
  • Supports processing files with international date and number formats.
  • Supports different character encodings if you need them.
  • Recognizes a wide variety of date and number formats when reading files.
  • Provides fine control of date and number formats when writing files.
  • Robust error handling, allowing you to quickly find and fix problems in large input files.

Looks like a worthwile addition to third-party LINQ implementations to me. The date-handling features are a must-have for production use.

Thanks to David Hayden for the heads up.

Rick Strahl Revisits Options for LINQ to SQL Dynamic Queries

Rick says in his Dynamic Queries and LINQ Expressions post of April 14, 2008:

I'm revisiting some code in my LINQ to SQL business objects layer that I've written about before. The problem I ran into and described was that I had a class with generic business object behavior that needs to look up values based on a database field that wouldn't be known until runtime.

He then goes on to examine these options:

  • Skip LINQ and use SQL strings with ExecuteQuery<T>
  • Dynamic Query
  • Use Lambdas instead of fixed Parameters
  • Storing and Reusing a Lambda Expression

As usual, it's a good read.

Matthew Hunter Releases Update to LINQ to SQL Entity Base

Matt says in New Version of LINQ to SQL Entity Base Class (Beta 3.0) of April 14, 2008:

In the example that comes with the LINQ to Entity Base, [I]'ve used the data contract serializer (which is what WCF uses to serialize/deserialize objects) to demonstrate this. I've also improved the example so you can scroll through the results by converting it to a simple windows form.

Matt's earlier posts about n-tier deployment and disconnected updates with LINQ to SQL are here.

Terry Aney Implements Batch Updating and Deletion for LINQ to SQL

Terry's Batch Updates and Deletes with LINQ to SQL post of April 14, 2008 is a further refinement of Jeffry Zhao's approach to the batch deletion topic in his LINQ to SQL Extension: Batch Deletion with Lambda Expression post of March 6, 2008.

Source code for Terry's project is available here.

Justin Etheredge Explores LINQ's Let Keyword

In The Linq "let" keyword of April 14, 2008, Justin covers the use of the let keyword in LINQ expression syntax to make queries more readable.

Beth Massi Continues Her LINQ to SQL n-Tier Smart Client Series

LINQ to SQL N-Tier Smart Client - Part 2 Building the Client (April 14, 2008) shows you how to build the "very simple Windows client form that works with our middle-tier" that her LINQ to SQL N-Tier Smart Client - Part 1 Building the Middle-Tier post of April 12, 2008 describes.

Eugenio Pace Shows You How to Search Across SSDS Containers

SQL Server Data Services (SSDS) ordinarily limits the scope of queries to a container, which is its basic unit of data storage. However, if you're willing to implement Eugenio's CrossTenantSearch helper class to run concurrent searches, you can overcome this limitation.

Eugenio's LitwareHR on SSDS - Part V - Searching across Containers post of April 13, 2008 contains a diagram

AppDrop Ports Google App Engine SDK to Amazon EC2

Andy Baio, the developer of Upcoming.org (now a Yahoo! service), describes Chris Anderson's AppDrop application:

How does it work? Behind the scenes, AppDrop is simply a remote installation of the App Engine SDK, with the user authentication and identification modified to use a local silo instead of Google Accounts. As a result, any application that works with the App Engine SDK should work flawlessly on AppDrop. For example, here's Anderson's Fug This application running on Google App Engine and the identical code running on EC2 at AppDrop.

Of course, this simple portability comes at the cost of scalability. The App Engine SDK doesn't use BigTable for its datastore, instead relying on a simple flat file on a single server. This means issues with performance and no scalabity to speak of, but for apps with limited resource needs, something as simple as AppDrop would work fine.

For additional AppDrop details and links, see Andy's Exclusive: Google App Engine ported to Amazon's EC2 post of April 14, 2008.

Microsoft's Red Dog Project Promises [Windows] Applications in the Cloud

LiveSide - News blog's Red Dog: Ray Ozzie's answer to the Google App Engine? post of April 9, 2008 claims that the "Microsoft Utility Computing Platform, code named Red Dog, sounds very much like a platform for building a Google App Engine type service (except maybe quite a bit better)" and also might be a competitor to Amazon's EC2.

A job posting by the Cloud Infrastructure Group gave this Red Dog feature list [paraphrased by LiveSide]:

  • An "efficient, virtualized" environment
  • A "fully automated service management system" (like the Google App Engine, you won't have to worry about managing the system)
  • On "highly scalable" storage services (you only use the storage you need)
  • The service will "scale to millions of machines" across Microsoft's data centers (geo-located, easy to maintain data centers, remember?)  
  • "[W]ill lead the marketplace as the best platform for rapid development, deployment, and maintenance of internet services and applications"
  • SDK and tools will be included for external and internal customers
  • V1 for external customers in the coming year

Mary Jo Foley adds some code-name spice to the topic in her Red Dog: Yet another unannounced Microsoft cloud service article of April 9, 2008.

EMC also has a Cloud Infrastructure and Services Division run by former Microsoft exec Paul Maritz.

Forthcoming Persistent Storage for EC2 Can Run Relational Databases

Developers will have another "database in the cloud" option when Amazon Web Services (AWS) releases its newly-announced persistent storage feature for their Elastic Computing Cloud (EC2) feature. According to Jeff Barr in the Amazon Web Services blog's Storage Space, The Final Frontier post of April 13, 2008:

[O]ur forthcoming persistent storage feature will give you the ability to create reliable, persistent storage volumes for use with EC2. Once created, these volumes will be part of your account and will have a lifetime independent of any particular EC2 instance.

These volumes can be thought of as raw, unformatted disk drives which can be formatted and then used as desired (or even used as raw storage if you'd like). Volumes can range in size from 1 GB on up to 1 TB; you can create and attach several of them to each EC2 instance. They are designed for low latency, high throughput access from Amazon EC2. Needless to say, you can use these volumes to host a relational database. [Emphasis added.]

There's more detail in Persistent Storage for Amazon EC2 post in the AWS Developer Connection blog, and RightScale's Amazon takes EC2 to the next level with persistent storage volumes, both of the same date.

Any chance that the Google App Engine announcement had something to do with Amazon's announcement timing?