Sunday, June 29, 2008

LINQ and Entity Framework Posts for 6/25/2008+

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

Updated: 6/29/2008

Jeff Currier Explains How SQL Server Data Services Manages Optimistic Concurrency Conflicts with SOAP

Jeff notes that managing optimistic concurrency conflicts with SSDS’s REST wire protocol and HTTP ETags is much simpler than handling similar problems with the SOAP protocol. His Optimistic Concurrency with SOAP in SSDS post of June 29, 2008 explains the VersionMatch class with its MatchType enum that Sprint #3 added to the Scope struct.

He demonstrates how entityScopeVersionMatch.Version and entityScopeVersionMatch.MatchType combine to enable a conditional Get(entityScope) operation, as well as conditonal updates and deletions.

Jeff promises to disclose “the biggest feature of the sprint (and one of our most requested features of the service that we have now completed for sprint 3....) … shortly.”

Added: 6/29/2008 1730 PDT

David Hayden Gives the LightSpeed 2.0 Object/Relational Mapping Tool a Glowing Review

Dave’s review in his LightSpeed 2.0 O/R Mapper - New Visual Designer with Database Schema Round-Tripping and LINQ Support post of June 29, 2008 starts with this paragraph:

I was pretty impressed with the LightSpeed O/R Mapper when it was first released, but the new Visual Studio 2008 Integrated Design Surface in LightSpeed 2.0 makes it really easy to develop and maintain domain models from a database. Just like with LINQ To SQL, you can drag and drop your tables from the Server Explorer onto the LightSpeed Visual Designer and have LightSpeed generate a model for you under the covers.

He also notes that v2.0 also enables round-tripping schema/model updates. You can update the database schema for model changes and vice-versa. Entity Framework only supports updating the model from the database; LINQ to SQL requires rebuilding the entire model after a database change.

LightSpeed 2.0 supports SQL Server 2005, MySQL 5, PostgreSQL 8, SQLite 3 and Oracle 9 or higher databases. Mindscape offers four LightSpeed 2.0 licenses:

  • Express (limited to eight model classes) is free
  • Standard (limited to 30 classes) US$99
  • Professional (no limit) US$299
  • Enterprise (no limit, includes source code) US$499

Added: 6/29/2008

Ian Cooper Explains the Pain Inflicted by Using LINQ to SQL in n-Tier Projects

Ian’s Architecting LINQ To SQL part 9 post of June 28, 2008 carries a “LINQ To SQL with N-Tier: Why is there pain?” subtitle. He cites Jon Kreuger’s LINQ to SQL In Disconnected/N-Tier scenarios: Saving an Object post of February 10, 2008 and Rick Strahl’s LINQ to SQL and attaching Entities post of August 12, 2007 as example of the pain.

Ian notes that you can serialize EntitySet and EntityRef collections with the NetDataContractSerializer, which the Entity Framework uses but LINQ to SQL embargos, but the DataContext isn’t serializable because it “contains non-remotable resources like a Db connection.” Ian continues:

This means you cannot gain change tracking and lazy loading by simply serializing your DataContext too. This tends to throw people who come from a DataSet background who have become used to serializing the context with the data. Indeed this ability to work in a disconnected fashion is trumpeted as a feature of the DataSet. As a result, this set of users tries to use LINQ to SQL in the same way and then becomes frustrated when they can’t.

Ian proposes a message-based system to eliminate the need to serialize entities, which requires referencing the domain model across tiers:

We should share schema not type. We want to send message[s] not transfer an instance of a type.

He then shows examples of two messages for a “trivial service.” Hopefully, part 10 will continue with a sample implementation of messaging to update entities of a less trivial service.

Added: 6/28/2008

Steve Naughton Fixes a Table-Name Problem in His Database Based Permissions Project

His DynamicData: Database Based Permissions - Part 5 post of June 28, 2008, subtitled “Oops! Table Names with Spaces in them and Pluralization,” fixes a problem that arises when you add the Order Details table and moves a substantial amount of code to the Global.asax file.

The post contains links to sample code with SQL Server 2005 and 2008 tables.

Added: 6/28/2008

Charlie Calvert Returns to the LINQ Farm Series with Posts on Lambdas and Extension Methods/Scoping

Two months have gone by since Charlie’s last LINQ Farm post (LINQFarm: Understanding IEnumerable<T>, Part I, April 28, 2008). He incremented the tutorial on June 28, 2008 with these two posts:

  • LINQ Farm: Lambdas compares “two ways of creating a delegate instance, and explain[s] how they map back and forth.”
  • LINQ Farm: Extension Methods and Scoping suggests that you “always place your extension methods in unique namespace separated from the rest of your code so that you can easily include or exclude the extension methods from a program.”

As usual, there’s good advice in both episodes.

Added: 6/28/2008

Alex James Writes a Detailed Analysis of the Computed Properties Feature for Upcoming Entity Framework v2

Alex’s Computed Properties One Pager of June 27, 2008 is a detailed examination of the proposed Computed Properties feature of EF v2. This feature is intended primarily to support EDM-based reporting services.

The plan is to support computed scalar singletons, scalar collections, and, ideally, “a collection of ComplexTypes, Entities and perhaps even RowTypes.” However, Alex notes that “Random projections (i.e. RowTypes) are much more difficult.”

Added: 6/28/2008

Eugenio Pace Adds a Virtual Earth GeoRSS Property to His LitwareHR SSDS Project

In LitwareHR and GeoRSS of June 27, 2008, Eugenio describes a new library that enables his LitwareHR SQL Server Data Services (SSDS) project to geo-enable open jobs with coordinates from the Virtual Earth.

After providing the RSS feed to include the geotags and adding the JobsMap page, and modifing the AddPosition page to include coordinates, Eugenio concludes:

There’s still some work to be done on the layout and general UI, but the basics are there. I’m planning to upload the whole LitwareHR solution to CodePlex TFS soon and all these additions will go with that, so stay tuned.

Added: 6/28/2008

Suggestions for Scott Hanselman’s Updated Northwind Sample Database

Scott’s not a fan of Northwind, but when he suggested a new replacement for Northwind in his Community Call to Action: NOT Northwind post of May 29, 2008, many developers pushed back in the 82 comments to his post.

His NotNorthwind - Update #1 - All Your Northwind Are Belong To Us post chronicles the “steering committee” decision:

We had a SkypeCast call today at noon and it was agreed that Northwind does have some redeeming qualities. It's simple, it works, it's understood and there's a pile of demos written against it. We rethought the requirements.

As a small group, we've decided to extend Northwind. We'll still call it NotNorthwind (although Super Northwind 2000 and "Microsoft Visual Northwind Enabler SP2 RC0 Beta1 July Refresh Plus Pack" were also possibilities), though, but we want to add a bunch of features that should make it a more interesting database for demos/prototyping/experimenting.

My Suggestions for Scott Hanselman’s Updated Northwind Sample Database post of June 27, 2008 lists 11 additions that I’d like to see a new “Southwind” sample database implement.

Added: 6/27/2008 1245 PDT; Fixed missing paragraphs: 6/27/2008 0730 PDT

Jimmie Bogard Refactors a Layered LINQ to SQL Project to Achieve Separation of Concerns, Testability, and Dependency Inversion

There are few concrete examples of how to achieve true separation of concerns with an LINQ to SQL (or Entity Framework) project. The first three episodes of Jimmie’s journey through a refactoring exercise on a sample application from a recent edition of ASP.NET PRO magazine appear to fill that void:

Part 3 extracts a dependency on the static DataContext to facilitate testing and implements the Repository pattern for the Customers entity set The promised Part 4 will implement dependency inversion and unit tests.

Note: Jimmie didn’t identify the article, but it looks to me that it’s Bilal Haidar’s “LINQed and Layered” piece from the June 2008 issues, which you can read from the PDF version here.

Added: June 27, 2008 1245 PDT

“Connect Enterprise Apps With Hosted BizTalk Services” Article by Aaron Skonnard and Jon Flanders on MSDN

Aaron’s My latest article on BizTalk Services post links to MSDN Magazine’s June 2008 issue and his article about BizTalk Services. He observes in the “BizTalk Services SDK” section:

The BizTalk Services SDK is a free download available from biztalk.net that will enable you to get started programming against ISB. Before you can get started, you'll need to install the BizTalk Services SDK and create a user account on the BizTalk Services site. BizTalk Services is built on Windows Communication Foundation (WCF). The SDK is just a set of assemblies built on the Microsoft .NET Framework 3.0 that allows you to use ISB via the WCF programming model.

The Internet Service Bus (ISB) is a Microsoft hosted service, similar in concept to SQL Server Data Services (SSDS). How SSDS, ADO.NET Data Services (Astoria), or both might integrate with ISB in the future is a question I’ll be exploring during the next couple of months.

Added: June 27, 2008 1245 PDT

Mike Kaufman Continues his EDM Tools Series with Model Validation and Generating Views

Mike’s EDM Tools | Options (Part 3 of 4) post of June 26, 2008 covers “Model Validation” and “Generating Views” topic. The final topic will be combining the code from the preceding posts into the EdmGen2.exe command-line tool.

Added: June 27, 2008 1245 PDT

SQL Server Data Services Needs an Open Development Process Similar to that for ADO.NET Data Services and Entity Framework

Soumitra Sengupta’s Philosophy behind the design of SSDS and some personal thoughts post of June 27, 2008 explains SSDS’s total lack of relational features (or some might say “baggage”) in its present incarnation. Soumitra says:

Since we made an early decision to limit the number of hard problems we needed to solve, we decided that we would focus less on the features of the service but more on the quality of the service and the cost of standing up and running the service.  The less the service does we argued, the easier it would be for us to achieve our objectives. [Emphasis added.]

My SQL Server Data Services Needs an Open Development Process Similar to that for ADO.NET Data Services and Entity Framework post of June 27, 2008 suggests that the SSDS team take a different approach.

Added: June 27, 2008 1245 PDT

Ryan Dunn Continues His SQL Server Data Services and Objects Series: Part 2

In Working with Objects in SSDS Part 2 of June 26, 2008, Ryan continues from Working with Objects in SSDS Part 1 and Serializing Objects in SSDS to accommodate relationships between entities because SSDS doesn’t support associations (yet). He creates “flexible” entities with a Dictionary<string, object> property called PropertyBucket to accommodate the added associations.

Hopefully, the SSDS team will add support for associations in one of their future “sprints.” (The sooner the better.)

Added: 6/26/2007 1700 PDT

David Robinson Wants You as an SSDS Beta User

Dave’s Still waiting for your golden ticket? post of June 26, 2008 says:

[W]e are ratcheting up the speed at which we add people. We are adding hundreds and hundreds each day. If you want to start testing the most powerful, cloud based, data and query processing service now is the time to sign up. In a couple short weeks we will be rolling out our Sprint 3 bits and there is a great deal of functionality coming.

I hate to flog a dead horse, but I’m still not seeing much SSDS-related activity in the SQL Server Data Services - Getting Started forum. However, there are plenty of off-topic posts about SQL Server 2005+.

Note: My cover story about SSDS for Visual Studio Magazine’s July 2008 issue will be on-line in less than a week. It includes sample code for uploading, querying and updating the original Northwind database to a single container or container per table model.

Added: 6/26/2008 1330 PDT

Ian Cooper Rings in with a Level-Headed Critique of Entity Framework v1

Ian Cooper was one of LINQ to SQL early proponents and Entity Framework detractors. This post points to his The criticism of the Entity Framework is not just around Domain Driven Design post of June 26, 2008 and includes links to his earlier posts about LINQ to SQL and EF. There’s also a link to my early recommendations to the ADO.NET team for EF.

Get the the link with the complete backstory and links to Ian’s LINQ to SQL tutorials in Ian Cooper Rings in with a Level-Headed Critique of Entity Framework v1.

Current Commentary About the “ADO.NET Entity Framework Vote of No Confidence” Manifesto

This is list of some of the more interesting posts about Scott Bellware’s ADO .NET Entity Framework Vote of No Confidence petition moved to a separate post of the same name on June 26, 2008 at 1600 PDT because of its length.

Marcin Dobosz Lists New Features in the “Dynamic Data Features” June 25, 2008 Update

Wonder what “Dynamic Data Features” is? It’s the new alias for “Dynamic Data Extensions,” a name that lasted just 10 days. Read all about its features updated since last week in Marcin’s Dynamic Data Features 6/25 update posted post of June 25, 2008.

Don’t be put off by the 6/17/2008 date on CodePlex’s main ASPNET page. The 6/25/2008 update appears here.

Mike Taulty Posts Code to Automatically Set Timestamp Fields in Entity Framework to Concurrency=Fixed

Mike notes in his Entity Framework - Timestamps and Concurrency post of June 26, 2008: If your SQL Server tables have timestamp fields, they’re undoubtedly present to participate in concurrency conflict management, so the EF runtime should have set their Concurrency property value to Fixed.

It doesn’t, so Mike provides code to handle the task automatically.

Mike Amundsen Posts Sample SQL Server Data Services Proxy Server and AJAX Web Client Apps

You can download the two-part project from Mike’s Web site. Mike says:

I think this pattern (SSDS web proxy + clients) is going to be a pretty common model. It has the advantage of not requiring all clients to know the credentials for the SSDS repository. However, it has the disadvantage of using a proxy through which all requests are made (kinda kills the scalability a bit, eh?).

Details are in his Posted An Example for comments thread in the SQL Server Data Services (SSDS) - Getting Started forum.

Justin Etheredge Continues His LINQ Expression Trees Series: Part 2

Justin’s Dissecting Linq Expression Trees - Part 2 post of June 24, 2008 provides the best illustrated explanation of the Visitor pattern for LINQ expression trees that I’ve seen so far.

Liam Cavanaugh Explains How to Take Advantage of SQL Server 2008’s Change Tracking Feature

Liam’s Using SQL Server 2008 Integrated Change Tracking to Optimize Data Synchronization post of June 25, 2008 shows Katmai’s Configure Data Synchronization dialog that “enables SQL Server to track data changes to your database rather than relying on you to create a change tracking technique.”

Liam notes that:

DBA's are less th[a]n enthusiastic when you tell them that in order to track changes, they will need to add triggers to each of the tables.

However, management usually is less than enthusiastic about paying upgrade bills. (SQL Server 2008 Express has change tracking, but not change data capture.)

Shawn Wildermuth Recommends Silverlight for Line of Business Applications Outside the Firewall but XBAP for Intranets

Shawn’s Silverlight and Line of Business Applications post of June 25, 2008 points to his geekSpeak Webcase on the topic but includes a length explanation of his position, including:

For my money, the real benefit in Silverlight is for applications that cross the firewall. This means Line of Business applicaitons are really for B2B and B2C solutions. Unfortunately, what I hear from the community is that people see Silverlight as a solution for porting their desktop and traditional 3-tier applications to the web. Is this a good idea? I don't think so. The problem is that desktop development usually involves business objects that tend to have a direct connection to the database. Moving these sorts of applicaitons to the web means that you need to create an extra layer of communications and serialization. There is a cost both in development and performance for these extra layers.

Three of My Cover Stories are Among the Top 10 Most Popular in Visual Studio Magazine This Year (So Far)

From the Self-Promotion and Swelled-Head Department: The Redmond Media Group’s .NET Insight newsletters for June 19 and June 26, 2008 listed my following cover articles for VSM among the top 10 most popular of all articles this year (to date):

2) Model Domain Objects with the Entity Framework (March 2008)

Microsoft's ADO.NET Team readies Entity Framework and Tools 1.0 for release as a VS 2008 add-in with enterprise-level features that LINQ to SQL doesn't offer -- domain object modeling, flexible inheritance techniques, multiple database vendors, and do-it-yourself n-tier deployment.

"Do-it yourself n-tier deployment" refers to Daniel Simmons' Entity Bag (Perseus) project, which is covered by a sidebar.

3) Visual Studio 2008 Kicks Off (January 2008)

Find out how VS 2008's greatly expanded feature set and new .NET Fx 3.5 namespaces can boost your career as a professional developer and add to your programming enjoyment.

Additional VS 2008 articles in the January 2008 issue:

7) Manipulate Data in the Cloud with ADO.NET (May 2008)

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.

 

Saturday, June 28, 2008

Current Commentary About the “ADO.NET Entity Framework Vote of No Confidence” Manifesto

Moved from LINQ and Entity Framework Posts for 6/25/2008+ on 6/24/2008 at 1600 PDT due to length. Updated: 7/3/2008 0830 PDT with copies of recent Tweets and 7/6/2008 with an added entry.

Here’s a list of some of the more interesting posts about Scott Bellware’s ADO .NET Entity Framework Vote of No Confidence petition, which had collected 417 votes as of July 6, 2008 0720 PDT:

For more background on the “No Confidence” petition, see Tim Mallalieu Addresses “ADO .NET Entity Framework Vote of No Confidence” Manifesto, New Entity Framework Design Blog Announces Transparent v2 Design Process, Ian Cooper Rings in with a Level-Headed Critique of Entity Framework v1.

Friday, June 27, 2008

Suggestions for Scott Hanselman’s Updated Northwind Sample Database

Scott’s not a fan of Northwind, but when he suggested a completely new replacement for Northwind in his Community Call to Action: NOT Northwind post of May 29, 2008, many developers, including me, pushed back.

I left the following comment to Scott’s NotNorthwind - Update #1 - All Your Northwind Are Belong To Us post on June 27, 2008:

Scott,

As a long-time and widespread Northwind user, I'd prefer Southwind (the maker of aircraft cabin heaters that have kept me warm on many cold nights at 9,500 ft.)

I use Northwind rather than AdventureWorks because AW is overly normalized and the added joins confuse readers by diverting their attention to database structure from the issue at hand.

I'd also suggest some additions:

  1. Add an item number (tinyint) and shipped (bit) field for backorders below.
  2. Invoices from shipped order with backorders. An sproc to issue an invoice with and without backordered items would be nice.
  3. A relation table for a one:many relationship between sales orders and invoices to support the above.
  4. Inventory transactions table to provide on-demand calculated data for related field in Products table
  5. Change Products table to many:many relationship with suppliers and add multiple suppliers for some products
  6. A Purchase orders table with line items as in #1 with received field working with inventory table.
  7. Sproc to automatically add or remove timestamp field for each table
  8. Sproc to automatically add or remove usual audit fields for each table
  9. Sproc to automatically add or remove Sync framework fields for each table
  10. Sproc to substitute surrogate for natural PKs or vice-versa
  11. Product reviews (by customers, suggested by someone else) would be great

Deletions: Remove CustomerDemographics, Territories, Region
Thanks for considering the above,

--rj

If you have any suggestions for improving Northwind, add a comment to Scott’s Update#1 or my blog. I’ll send posts here to Scott.

SQL Server Data Services Needs an Open Development Process Similar to that for ADO.NET Data Services and Entity Framework

Soumitra Sengupta’s Philosophy behind the design of SSDS and some personal thoughts post of June 27, 2008 explains SSDS’s total lack of relational features (or some might say “baggage”) in its present incarnation. Soumitra says:

Since we made an early decision to limit the number of hard problems we needed to solve, we decided that we would focus less on the features of the service but more on the quality of the service and the cost of standing up and running the service.  The less the service does we argued, the easier it would be for us to achieve our objectives. [Emphasis added.]

The last sentence applies to any software product or service. Taken to the extreme, this approach favors a service that does nothing. The SSDS Team’s objectives might not coincide with potential user’s objectives at this point in SSDS’s development.

Presently SSDS doesn’t have a role-based security model, support joins, order the sequence of returned entities, deliver aggregate values, or offer the other accouterments that DBAs and developers have come to expect from commercial and open-source RDBMSs. Obviously, SSDS’s target audience isn’t expecting drag-and-drop table and form generation offered by QuickBase and DabbleDB. But even after sprint #2 SSDS remains too “bare-bones” for me and most developers I’ve talked to.

At the end of his post, Soumitra throws the following bone to potential early adopters:

Over time, … as we learn what it takes to run a 24x7x365 service (nobody we know of is running a data service using a commercial database system at this scale and cost point) like SSDS, I can assure you we will start to expose capabilities of the underlying engine.  How quickly and how much will depend on our ability to provide you, our customers with the quality of service you need to trust your business to SSDS.

Sounds like a chicken and egg problem to me. Most organizations won’t devote resources to testing an offline database with the few features that SSDS offers today, let alone trust its business to SSDS without an inkling of if and when needed features will be implemented. I’m surprised by the few vague and guarded descriptions of SSDS features in the works, such as schemas, and the rationale behind their implementation.

The SSDS team should emulate Tim Mallelieu’s approach of describing new Entity Framework v2 features in advance and adoption of an open development process, which was initiated by Pablo Castro for Astoria. Tim made it clear what the priorities for EF v2 are in his Transparency in the design process post of June 23, 2008.

Note: Since we don’t know what SSDS’s current scale and cost point are, we can’t make a comparison with QuickBase, which is undoubtedly today’s most successful online RDBMS with 250,000 users and a newly established Developer Program.

Thursday, June 26, 2008

Ian Cooper Rings in with a Level-Headed Critique of Entity Framework v1

Ian’s The criticism of the Entity Framework is not just around Domain Driven Design post of June 26, 2008 likens Entity Framework v1 to early versions of Enterprise Java Beans (EJB):

EJBs were an ambitious attempt to support persistence, transactions, events, [remote procedure calls (RPC)], etc., in a single component. While there was an initial rush to adoption, they quickly proved a millstone around the Java communities neck, because of their complexity. Technologies like Spring and Hibernate emerged as less-complex ways of delivering enterprise class solutions, many of them were later to be incorporated into drastically revised EJB visions.

The .NET community had a huge amount to gain from this experience. Ports of Hibernate and Spring offered the community the chance to avoid the mistakes of the past. However, seemingly unaware of the lessons of history the EF team embarked on a project to produce a complex framework, of which persistence is just one aspect, reminiscent of the EJB initiative. So the reaction against the EF comes from its failure to learn lessons that another community has struggled with around complexity and ambition.

So the warnings issued around the EF are trying to prevent .NET developers straying into the same path of pain that their Java brethren experienced with complex non-PI frameworks.

He concludes with an analysis of why domain-driven design is preferable to data-driven architectures.

Backstory: Ian Cooper was one of LINQ to SQL early proponents and Entity Framework detractors. Ian wrote the first analysis of the architectural patterns supported by LINQ to SQL in his Being Ignorant with LINQ to SQL post of June 10, 2007 which concluded:

LINQ to SQL is usable with a TDD/DDD approach to development. Indeed the ability to swap between LINQ to Objects and LINQ to SQL promises to make much more of the code easily testable via unit tests than before.

His post garnered 122 comments.

My Ian Cooper Takes on DDD, TDD and PI with LINQ to SQL post of June 11, 2007 is a lengthy review of his analysis and includes a link to Ian’s earlier critique of EF, LINQ to Entities and Occam's Razor.

My post includes a link to Defining the Direction of LINQ to Entities/EDM post of May 29, 2007, which includes a lengthy comment on my recommendations by ADO.NET Architect Michael Pizzo.

Note: If you’re working with LINQ to SQL, Ian has written an eight-part tutorial entitled Architecting LINQ to SQL Applications. This, alone, should prove Ian’s not an architectural bigot.

Update 6/26/2008 1610 PDT: Added “Ian Cooper was one of LINQ to SQL early proponents and Entity Framework detractors” sentence from linking entry for clarification.

Tuesday, June 24, 2008

Tim Mallalieu Addresses “ADO .NET Entity Framework Vote of No Confidence” Manifesto

In the tradition of Émile Zola’s “J'accuse” and Martin Luther’s The 95 Theses letters, the ADO .NET Entity Framework Vote of No Confidence petition in the form of a WuFoo page with attached Entity Framework Vote of No Confidence Signatories table had gathered more than 150 signatures by mid-afternoon of June 24, 2008.

The petition focuses on these five theses:

  1. Inordinate focus [on] the data aspect of entities leads to degraded entity architectures
  2. Excess code [is] needed to deal with lack of lazy loading
  3. [A] shared, canonical model contradicts software best practices
  4. Lack of persistence ignorance causes business logic to be harder to read, write and modify, causing development and maintenance costs to increase at an exaggerated rate
  5. Excessive merge conflicts [occur] with source control in team environments

Three of the signatories, Jeremy D. Miller, Scott Bellware, James Kovacs, and Dave Laribee are among the seven Microsoft MVPs who “took apartDanny Simmons and others on the ADO.NET team at the MVP Global Summit in Seattle on March 14, 2007 and taught them NHibernate. Ayende Rahien, a.k.a. Oren Eini, a primary contributor to NHibernate, the best-known EF competitor, is another MVP involved in last year’s controversy who signed the petition.

The primary complaint at that time was lack of persistence ignorance, which I covered in detail by my Persistence Ignorance Is Bliss, but Is It Missing from the Entity Framework? post of March 17, 2008. Data-centric design was also a topic of contention.

I’m surprised to find lack of an “out-of-the-box n-tier story” missing from the list. Most developers consider lack of SOA-friendly features is more significant than data-first design, which is necessary when connecting to legacy databases.

On the whole I consider the “No Confidence Manifesto” to be doctrinaire and an example of attempts to enforce “political correctness” in software architecture. I’d wager that EF would perform more than adequately in 80% or more of the applications that require O/RM tools. It appears to be adequate for the Astoria team (It’s required to create updatable entities.) It works fine for me with the EntityDataSource and ASP.NET Dynamic Data.

A Serious Case of Hubris

Update 6/24/2008 1730 PDT re "doctrinaire” and “political correctness”

In a comment to Tim Lee’s detailed Thoughts on the Entity Framework Vote of No Confidence of 6/23/2008 an anonymous commenter says:

The perspectives in the letter are fed by many years of experience in building entity-based applications using the various techniques and frameworks that our evolving awareness of issues led us to along the way.

It's great that you're questioning the validity of the claims of the letter and expressing your perspective.  I don't think that we can possibly have the same perspective because of the different experiences between us.

Frankly, we can't really argue this issue on a peer level.  You'll have to practice entity-based designs within the context of practices that support reversability and the levels of productivity we get from choices of tooling and approach that have been honed by quite a bit of time invested in trial and error over the years.

And yes, I know that you can take this comment as pomp and arrogance.  That always seems to be the risk in the .NET developer community when we tell someone that there's much more experience to be gained and much more learning to do. [Emphasis added.]

Sounds like serious hubris to me. I wonder who was the author. (The comment form doesn’t have provision for entering a name or URL, but the author could easily have done so in the comment’s body.)

Update 6/25/2008: The author of the comment to Tim Lee’s post was Scott Bellware. See his comment to this post.

Fear and Loathing

That’s the coincidentally appropriate name of Bil Simser’s blog that contains his ADO.NET Enity Framework Vote of No Confidence post of June 23, 2008. (He’s one of the Manifesto’s MVP signatories.) If you really want to stick the knife in, accuse users of being “VB6 drag-n-drop programmers,” as in this excerpt:

Over the past year or two, I've been a casual observer into the Entity Framework coming out of Microsoft. Being an ALT.NET guy, the world tends to revolve around NHibernate for me so I've already got an excellent OR/M tool in my toolset. One of the big issues with EF that we've recognized is the general direction Microsoft has taken with it, following a data centric model rather than an object one. …

What we see on the horizon is a new breed of VB6 drag-n-drop programmers embracing EF as the next Messiah. We see a new generation of developers focused on mapping their data models and missing the target of architecting and constructing well designed systems.

It appears to me that the “NHibernate Mafia” are becoming the “ALT.NET Third Reich.” I’m surprised Bil didn’t sign his post “Elvis” or “Einstein.”

My conclusion is that the NHibernate Mafia is attempting to protect a vested interest in NHibernate as a result of the investment in time and effort to needed to become an apprentice NHibernate plumber, let alone a journeyman. You need to bill a large number of client-hours to recoup the learning curve. An O/RM tool that can handle, say 80%, of the bread-and-butter applications that keep most developers mortgage paid with RAD design tools must truly be a chimera.

Tim Mallalieu Responds to the Petitioners

Unlike Zola, the petition signatories weren’t prosecuted for libel, nor were they requested to recant their theses, as Pope Leo X insisted of Luther. Instead, Tim Mallalieu quickly addressed the issues raised in the manifesto by his Vote of No Confidence post of June 24, 2008. Entity Framework v2 will deal with theses 1, 2 and 4. I’m not convinced that thesis 3 is well taken. Issue 5 appears to be up in the air at the moment.

Mary Jo Foley’s Testers give Microsoft’s Entity Framework a no-confidence vote post of the same date puts the manifesto in perspective. Scott Bellware, who said in this comment that he was “the principal author” of the petition, requested that Mary Jo recant her classification of the signatories as “testers.” Scott’s comment to my persistence ignorance post, my reply, and Danny Simmons’ response start here. Scott’s primary concern at the time was availability of the EDM Designer in v1, not data-centricity.

Update 6/25/2008: Mary Jo’s column hit Techmeme on 6/24/2008 at 4:45 PM. My favorite comment to her column: “I'm not a tester: I've never installed nor tested an Entity Framework beta, but I signed the vote of no confidence” by odenni.

The manifesto had 226 signatories by 6/25/2008 at 8:30 AM.

Rebuttals to the Manifesto

Julie Lerman’s Oh that no-confidence vote on E.F. post of June 24, 2008 is a reasoned objection to the purpose, and therefore much of the substance, of the petition.

Update 6/24/2008 1815 PDT Added below:

But the most detailed, measured and even-handed response to the manifesto comes from Ward Bell, VP of Product Management of IdeaBlade, Inc. who posted Rejoinder #1 to "Vote of No Confidence in Entity Framework" late Wednesday. IdeaBlade produces the DevForce .NET enterprise application development framework. Its DevForce EF integrates EF with the DevForce framework to add advanced mapping and LINQ features.Dev Force contributes n-tier capabilities with its Business Object Server (BOS) and a full object graph caching on the client. DevForce EF is in the release candidate stage, which qualifies IdeaBlade in my view as an enterprise class user. A beta of a Silverlight 2 DevForce EF client is due in four to six weeks.

His post covers too much territory to summarize here. Just read it.

Update 6/25/2008: Dinesh Kulkarni’s Design of LINQ to SQL - What was I thinking or was I? post of 6/24/2008 is a parody of the manifesto’s author(s) position.

New Zealand (Kiwi) Australian developer Keith Patton’s A vote of confidence for the Entity Framework post of 6/24/2008 begins:

I've been working solidly with EF since the SP1 beta came out and can honestly say it's holding up very well across a large, enterprise data model structure, and alongside usage of a repository pattern and dependency injection to factor out most of the direct dependencies on the EF ObjectContext, we have a system that can move towards POCO over time with relatively little refactoring.

And continues with a detailed refutation of the manifesto’s theses.

Update 6/25/2008: Corrected Keith’s locale (see comments).

New Entity Framework Design Blog Announces Transparent v2 Design Process

Tim Mallalieu’s first post since taking over as Entity Framework (EF) program manager in the Autumn of 2007, Transparency in the design process of June 23, 2008, describes what’s in store for EF v2:

  • Persistence Ignorance (PI) with full Plain Old CLR Object (POCO) support for state management and ObjectContext interaction
  • N-Tier Support for remoting object graphs with change tracking using WCF
  • Code-First domain modeling with convention-based mapping instead of v1’s data-centric, forms-over-data approach
  • Test-Driven Development (TDD) Scenarios with POCO and virtual ObjectQuery<T> and entity classes
  • Foreign Key modeling support in addition to associations
  • Lazy Loading options, possibly implicit lazy loading
  • Query Tree Re-Writing to enable filtering query results horizontally and vertically without attempting to modify the expression tree

These are the features required take EF out of the curiosity category and move it to an enterprise-class framework that’s capable of competing on a level playing field with NHibernate. They are precisely the features that the so-called “NHibernate Mafia” claimed were missing from EF v1’s original design.

For more background about persistence ignorance and POCO, see my Persistence Ignorance Is Bliss, but Is It Missing from the Entity Framework? post of March 14, 2007.

Tim is adopting Pablo Castro’s transparent design process for ADO.NET Data Services (Astoria), which I recommended to the SQL Server Data Services (SSDS) team last week. Tim promises to expose the design process:

What exactly would we make visible? In short, our design process. To be more concrete, I’m not talking about some fancy set of specifications. What I mean is that as we go through the detailed design of the various aspects of Entity Framework V2, we would post to this blog a) the meeting notes from our design meetings (the team has a design meeting twice a week, plus a lot of impromptu hallway chats), and b) deeper write-ups of specific design challenges where we’d like folks to understand how we’re approaching a problem and provide a channel for deep, detailed feedback.

Notice that there’s no mention of LINQ to SQL in this post, which undoubtedly represents the death knell for future improvements to LINQ to SQL. See my Is the ADO.NET Team Abandoning LINQ to SQL? post of May 23, 2008 for an earlier travelogue about LINQ to SQL’s journey to legacy product purgatory.

Update 6/24/2008 1500 PDT: Moved to a full post and following added:

It might or might not be a coincidence that an ADO .NET Entity Framework Vote of No Confidence petition in the form of a WuFoo form with attached Entity Framework Vote of No Confidence Signatories table appeared almost simultaneously with Tim’s original post.

Get the full story in the Tim Mallalieu Addresses “ADO .NET Entity Framework Vote of No Confidence” Manifesto post of 6/24/2008.

LINQ and Entity Framework Posts for 6/23/2008+

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

Initial Entity Framework POCO DesignFeature 1-Pager  on Entity Framework Design Blog

True to his word, Tim Mallalieu posted on June 24, 2008, an Initial POCO Design 1-Pager which was intended to be an “Initial POCO Feater 1-Pager.”

The post starts with a Part 1 Overview that lists Jimmie Nilsson’s six requirements/assumptions that are verboten in a persistence ignorant design.

Part 2 Context reiterates that POCO support in v2 would require abandoning the IEntityWithRelationships and IEntityWithChangeTracking interfaces and POCOs can’t use attributes to map object members to the conceptual schema.

Part 3 Design shows classes for Customer and Order entities with a 1:many relationship between them.

O-Space to C-Space mapping is done by convention – i.e. the CLR types of the entities below map to the corresponding entities already defined in the Conceptual Model.

Code for the POCO partial classes for such entities is shown, together with a sample query and addition of a pair of entities. So far, it looks like POCO to me.

Added: 6/24/2008

Tim Mallalieu Addresses “ADO .NET Entity Framework Vote of No Confidence” Manifesto

In the tradition of Émile Zola’s “J'accuse” and Martin Luther’s The 95 Theses letters, the ADO .NET Entity Framework Vote of No Confidence petition in the form of a WuFoo form with attached Entity Framework Vote of No Confidence Signatories table had gathered more than 150 signatures by mid-afternoon on June 24, 2008.

It’s certain that Mary Jo Foley’s Testers give Microsoft’s Entity Framework a no-confidence vote post of the same date was responsible for the rapid increase in signatories during the afternoon.

Read all about the manifesto and Tim’s Vote of No Confidence reply in this full-length post.

Update 6/25/2008: Mary Jo’s column hit Techmeme on 6/24/2008 at 4:45 PM. My favorite comment to her column: “I'm not a tester: I've never installed nor tested an Entity Framework beta, but I signed the vote of no confidence” by odenni.

The manifesto had 226 signatories by 6/25/2008 at 8:30 AM.

Added: 6/24/2008 1500 PDT

New Entity Framework Design Blog Announces Transparent v2 Design Process

Tim Mallalieu’s first post since taking over as Entity Framework (EF) program manager in the Autumn of 2007, Transparency in the design process of June 23, 2008, describes what’s in store for EF v2:

  • Persistence Ignorance (PI) and Plain Old CLR Objects (POCO
  • N-Tier Support for remoting object graphs with change tracking using WCF
  • Code-First domain modeling instead of v1’s data-centric, forms-over-data approach
  • Test-Driven Development (TDD) Scenarios with POCO
  • Foreign Key modeling support in addition to associations
  • Lazy Loading options, possibly implicit lazy loading
  • Query Tree Re-Writing to filter query results horizontally and vertically

Tim is adopting Pablo Castro’s transparent design process for ADO.NET Data Services (Astoria), which I recommended to the SQL Server Data Services (SSDS) team last week.

For the full story see the New Entity Framework Design Blog Announces Transparent v2 Design Process post of 6/24/2008.

Added: 6/24/2008 and moved to a separate post.

Scott Hunter Explains How to Integrate Dynamic Data Pages with an Existing ASP.NET Web Application

Scott’s earlier post, reported in the “Scott Hunter Demonstrates Integrating Dynamic Data with an Existing ASP.NET Site” topic below covers integrating ASP.NET Dynamic Data with file-system Web sites.

His How to add Dynamic Data to an Existing Web Application sequel of June 24, 2008 covers conventional ASP.NET Web applications.

The process is a bit different for Web apps because you use Project Explorer’s Add Reference feature to add the System.ComponentModel.DataAnnotations, System.Web.Abstractions, and System.Web.DynamicData and System.Web.Routing namespaces.

Scott notes that you also must conform namespaces in the Dynamic Data code-behind files you add.

Added: 6/24/2008

Jaroslaw Kowalski Posts a “Not for Production” Entity Framework Provider for Oracle

Jarek’s Sample Entity Framework Provider for Oracle post of June 23, 2008 describes an entity provider similar to the EFSampleProvider but targets System.Data.OracleClient instead of System.Data.SqlClient.

Some interesting non-default type mappings:

  • EFOracle.number(1,0) maps to Edm.Boolean
  • EFOracle.number(5,0) maps to Edm.Int16
  • EFOracle.number(11,0) maps to Edm.Int32
  • EFOracle.raw(16) maps to Edm.Guid

Jarek says the following about Canonical Functions:

Most Canonical Functions required by Entity Framework have been implemented using Oracle's built-in functions. In some cases it required some query rewriting, such as when handling Right() canonical function which has no direct Oracle translation and SUBSTR() must be used instead.

Danny Simmons’ Items of Interest: Sample Oracle Provider, Transparent Design Process post of June 24, 2008 points out:

I should stress that this is a sample not an official supported Oracle provider from Microsoft, but it is designed to help provider writers learn more about building providers for the EF, as well as to highlight some of the particular challenges encountered in briding between the EF's view of the world and that of Oracle, to fully demonstrate the provider-agnostic nature of the EF, etc.

Added: 6/24/2008 1000 PDT

Justin Etheredge Starts Two-Part Series about LINQ Expression Trees

Justin’s Dissecting Linq Expression Trees - Part 1 post of June 23, 2008 explains why LINQ expression trees are called Abstract Syntax Trees (ASTs) and explains why they are handy for:

  1. Tree modification before execution - You can actually modify the tree before it is compiled. You could join operations or simplify the tree before compiling it.
  2. Combining trees: This is in line with number 1, but you can take multiple expression trees and combine them using new Expression tree nodes. (Yes, you can manually generate these, and we will get into those later on)
  3. Alternate Execution: You can take an expression tree and interpret it and execute it in your own manner. This is precisely what LINQ To SQL does. It takes an expression tree and interprets it, then turns it into SQL instead of runnable MSIL

This post covers items 1 and 2. Part 2 will cover item 3.

 Added: 6/24/2008 1015 PDT

Mike Pizzo to Push Entity Framework and ADO.NET Data Services Tuesday at Sys-Con’s SOA World Conference & Expo in the Big Apple

The SOA World Magazine News Desk ran this somewhat redundant LINQ, Entity Framework and ADO.NET Entity Framework and Data Services for the Web head for a story about a presentation by the ADO.NET Data Programmability Group’s Principal Architect, Mike Pizzo, to the 13th International SOA World Conference & Expo 2008 East at the Hotel Roosevelt in New York City.

Strangely, Mike’s presentation is missing from the “Speakers/Sessions from Industry-Leading Companies” list on the SOA conference’s main page. It turns out that he’s speaking at Data Services World at SOA World 2008. Another case of you can’t tell the conferences from one another without a program.

Added: 6/23/2008 1710 PDT

Update 6/24/2008: I assume that Mike is announcing the the Entity Framework v2 transparent design program a the conference.

Mike Kaufman Tackles Model and Code Generation in Episode 2 of the Entity Framework Tools Series

Mike’s EDM Tools | Options (Part 2 of 4) post of June 23, 2008 describes how to use EdmGen.exe to generate the CSDL file with the EntityStoreSchemaGenerator object and the MSL/SSDL files with the EntityModelSchemaGenerator, as well as EntityClassGenerator to generate the partial entity classes. The post includes a link to download the related source code.

The next and final episode will take on validation and view generation.

Scott Hunter Demonstrates Integrating Dynamic Data with an Existing ASP.NET Site

Few sites that use ASP.NET Dynamic Data will consist solely of scaffolded pages. Scott’s How to add Dynamic Data to an Existing Web Site post of June 23, 2008 provides detailed, step-by-step instructions for integrating scaffolded pages into an existing ASP.NET site. The process involves:

  1. Creating a dummy ASP.NET Dynamic Data Web site and copying the DynamicData folder as well as Site.css and Site.master files to the existing project.
  2. Copying the Global.asax file to the existing site or add the model registration and routes to an existing Global.asax file.
  3. Modifying Web.config’s <compilation>, <pages>/<controls>, <httpModules> or <system.webServer>/<modules> sections.
  4. Registering your data model (LINQ to SQL, Entity Framework, LLBLGen Pro, etc.) and, optionally, enabling scaffolding.

Scott notes:

We hope to add a tooling gesture to Visual Studio in the future to automatically do these steps. Once these steps are complete you can start taking advantage of Dynamic Data functionality in your existing applications.

A Wizard dialog to handle the preceding steps sounds like a good idea to me.

Bart De Smet Continues His LINQ to MSI Implementation by Adding “Fluent Classes”

In his LINQ to MSI - Part 2 - Queryable without an I post of June 23, 2008, Bart introduces “a series of ‘fluent classes’ that provide a limited query pattern.” Topics of the lengthy article are:

  • The query provider
  • Representing tables
  • The built-in query pattern
  • Query data
  • Back to the Table<T>
  • Query, OrderedQuery and ClosedQuery
  • Known limitations

Bart’s next post will cover query translation.

Jim Wooley Explains How to Emulate Dynamic SQL with a Stored Procedure for Retrieving Associated EntitySets and EntityRefs

Jim’s Fetching child records using Stored Procedures with LINQ to SQL Post of June 23, 2008 shows how to write methods of the DataContext’s partial implementation to return EntitySets or EntityRefs from associated entities.

He also reminds those who’ve forgotten: LINQ is not about working with databases

John Papa Provides a Handy Cheat-Sheet for Silverlight 2 Data Binding Modes

His Sivlerlight 2 Binding Modes Diagram from his forthcoming Data Access with Silverlight 2 book illustrates how OneTime, OneWay, and TwoWay data bindings behave.

Sunday, June 22, 2008

LINQ and Entity Framework Posts for 6/18/2008+

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

Steve Gentile Posts a Brief Account of His First Brush with Silverlight 2 Beta 2 Databinding to LINQ to SQL

In his Stepping into Silverlight… post of June 21, 2008, Steve test-drives Silverlight 2 databinding to LINQ to SQL with the assistance of the Swiss MSDN tutorials, specifically the Silverlight 2 Beta1 + WCF + LINQ to SQL = a powerfull combination video of March 17, 2008. The Swiss sample is available for download as an attachment to the post.

Be sure to read Steve’s tips in his second update.

Added: 6/22/2008 1610 PDT

Soumitra Sengupta Explains Why There Are No Docs for Full-Text Search Over SQL Server Data Services

I included a note in the “Soumitra Sengupta: SQL Server Data Services Targeting Sprint 3 Update in a Week or Two” topic below about missing docs for SSDS’s new full-text search (FTS) feature. Soumitra clears up my Confusion about Full Text Search in SSDS on June 22, 2008, in which he quoted my note (without attribution).

It turns out he was speaking about adding FTS to the back end, with exposure by the front-end web service to follow. He then said, “So from now on when I talk about new features, I will just talk about features that are accessible through SSDS webservice to avoid confusion.”

I second Mike Amundsen’s comment:

Hey, it's fully understandable that you have 'back-end' and 'front-end' rollouts that might be 'out-of-sync' from the user perspective. But *please* keep us posted on both aspects, OK? 

Knowing that an item is in the back-end, even if it means we'll need to wait a bit before it's exposed to clients, is still interesting news.

A more open approach such as Pablo Castro uses for Astoria might be more effective:

This post is part of the transparent design exercise in the Astoria Team. To understand how it works and how your feedback will be used please look at this post.

(Mike and I have known each other for many years.)

Added: 6/22/2008 1115 PDT

Jeff Currier Describes Use of ETags and the HEAD Method for Managing Concurrency Issues with SQL Server Data Services

Jeff’s ETag's, Optimistic Concurrency and SSDS post of June 22, 2008 describes the role of HTTP ETag header values as timestamp equivalents in RESTful updates to SQL Server Data Services (SSDS) entities. Updating an entity increments its numeric Version value, so the the Version attribute value is used as the ETag for conditional, single-entity GET, PUT, and DELETE method invocations. Jeff says ETags aren’t applicable to query operations because they can return multiple entities.

He also mentions that SSDS will support the HEAD method, which just returns specified header values. This permits lightweight client-side comparison of server ETag values without performing an operation on the data.

Added: 6/22/2008

Steve Naughton Completes His Database Based Permisions Series for ASP.NET Dynamic Data and Posts the Source Code

His DynamicData: Database Based Permissions – Part 4 adds attribute-based permissions to consume the database-based metadata.

This post includes links to download source code for SQL Server 2005 and 2008 versions.

Added: 6/21/2008 1710 PDT

Steve Naughton Uses the InMemoryMetadataProvider to Add Runtime Permissions for ASP.NET Dynamic Data

Steve’s DynamicData: Database Based Permissions - Part 3 takes advantage of Marcin Dobosz’s InMemoryMetadataManager to apply TablePermissionAttributes and and TableColumnAttributes.

Added: 6/21/2008

ADO.NET Team’s Mike Kaufman Starts Four-Part Series about Options for Entity Data Model Tools

Mike observes in his EDM Tools | Options (Part 1 of 4) post of June 20, 20008:

Internally, the Data Programmability team refers to a set of these [CSDL, MSL, SSDL] files as “c/m/s files”. The EDM Tools Team made a decision [to] simplify the VS experience by aggregating the c/m/s files into a single .edmx file. The unfortunate state of affairs for V1 is that EdmGen.exe and the Entity Framework APIs [System.Data.Entity.Design] that ship in the .NET runtime can’t read EDMX files.

Here’s a brief description of the contents of the four episodes:

  1. Difference in file formats between the Visual Studio tools and the Entity Framework APIs in the .Net Framework
  2. Generating models from a database and code from a model
  3. Validating models and mappings
  4. EdmGen2.exe: A command-line tool that understands how to read and write the EDMX file formats and can replace the original EdmGen2.exe

Full source code for EdmGen2.exe is available from the MSDN Code Gallery.

Added: 6/21/2008

Sanjay Nagamangalam Demonstrates How to Use a T4 Template to Generate Entity Framework Views

Sanjay’s Using a T4 template for View Generation post of June 20, 2008, shows you how to use the Text Template Transformation Toolkit in VS 2008 with the CSharpViews.tt or VisualBasicViews.tt templates from an enclosure to his post to generate precompiled Entity Framework views.

The advantage of compiling views is reducing the initial startup time of a session. Moving from using EdmGen.exe to the prebuilt T4 template solves several problems and simplifies the process.

Be sure to read the tips at the end of Sanjay’s post before you test-drive his tutorial.

Added: 6/20/2008 1400 PDT

Troy Magennis Analyzes LINQ to Objects Aggregate Functions’ Response to Special Cases

Troy Magennis, the curator of the Hooked on LINQ wiki, started a new blog that contained a LINQ over Objects Aggregate Functions Special Case Table post of October 3, 2006. I hadn’t seen it when Troy posted it and found it still interesting today. The table provides responses of Sum(), Min() an Max() operators to null source, empty source, source with >0 nulls, and source with all nulls conditions for all common CLR numeric data types.

Added: 6/20/2008

ADO.NET Team Posts New EntityDataSource Tutorial for ASP.NET Data Controls

Eric Dettinger, an Entity Framework SDET, posted Tutorial: Entity Data Source Control on June 18, 2008. The illustrated, step-by-step tutorial uses the AdventureWorks database to create a three-level (Categories, SubCategories, and Products) with EntityDataSource components populating a Web app with three linked DataGrid controls.

Added: 6/19/2008 1820 PDT

Steve Naughton Adds a User Interface to Modify His New Database-Based Permissions

The steps involved in moving from Steve’s original application design to handle role-based permissions in the database that acts as the persistence store are:

    1. Create the database tables.
    2. Add a User Interface to modify the permissions.
    3. User Marcin's InMemoryMetadataProvider to add the database based permissions to the Metadata at runtime.
    4. Add components from A DynamicData Attribute Based Permission Solution using User Roles to consume the database based metadata.

Steve’s DynamicData: Database Based Permissions - Part 2 post of 9/19/2008 covers step 2.

The “Steve Naughton Starts Database-Based Permissions Series for ASP.NET Dynamic Data” topic covers step 1.

Added: 6/19/2008 1210 PDT

David Robinson Distills SQL Server Data Services Best Practices from His Tech*Ed 2008 Sessions

Dave’s Best Practice - Data Partitioning post of June 18, 2008 deals with data partitioning over authorities and containers. Data partitioning was one of the topics of his “Best Practices in Building Applications with Microsoft SQL Server Data Services” presentation at Tech*Ed 2008 Developer and IT Pro.

Using a Movie Showtimes application, he partitions the data into western and eastern authorities which he specifies to be located in western and eastern datacenters. (The current beta allows only one authority per participant and specifying location isn’t supported.)

Dave’s recommendations:

  • Take advantage of the Geo-Location aspect of Authorities
    • Choose an authority closest to your users
  • Take maximum advantage of Containers
    • Containers are placed on individual nodes
    • Partitioning your data across containers maximizes your throughput on Query and CRUD operations.

Added: 6/19/2008

David Ebbo: ASP.NET Dynamic Data’s Support for Data Sources Other Than LinqDataSource or EntityDataSource

In his Using ASP.NET Dynamic Data with ObjectDataSource post of June 18, 2008, Dave notes that VS 2008 SP1’s Dynamic Data feature supports LINQ to SQL and Entity Framework data sources by default and will work with other data sources that support LINQ and provide a data context object that defines each EntitySet by a class.

By taking advantage of the Dynamic Data Extensions (see the “David Ebbo: ASP.NET Dynamic Data Extensions and Samples Added to CodePlex” topic below), you can back Dynamic Data with a traditional combination of an entity class, business logic layer, and ObjectDataSource component.

The post contains a screen capture of a demo app with IntegerSlider and DateAjaxCalendar controls.

Added: 6/19/2008

Marcelo Lopez Ruiz Delivers a Lecture About .NET Mutability with a Brief Astoria Punchline

The upshot of Marcelo’s Mutability in the .NET Framework post of June 18, 2008 is the same as his prior two posts about ADO.NET Data Services: Initialize your service. He concludes:

[T]he object that you get is mutable while InitializeService is executing, but once it's finished, it becomes read-only. … This is all part of the work done to ensure that the security and metadata settings initialized through the configuration 'stick' to the service across all requests and provide a uniform interface to callers.

Added: 6/19/2008

Rob Conery Demonstrates the Repository Pattern for Improving Testability of Data-Backed Apps

Rob’s SubSonic: Writing Decoupled, Testable Code With SubSonic 2.1 post of June 18, 2008 doesn’t have much to do with SubSonic. He creates a SubSonicMVC solution with four projects:

  • ASP.NET MVC Website
  • Data Access Project (Class Library)
  • Business Logic (Class Library)
  • Test Project (using MS Test)

For data access with Northwind, he creates a Product class, an ICatalogRepository interface with a GetProducts() method of the IList<Product> type, and implements the interface with SubSonic. His tests use Dependency Injection (DI) to substitute a SubSonicCatalogRepository for a stub TestCatalogRepository when needed.

In short, a brief, very welcome example of implementing a testable, layered Web app with a repository and DI.

Added: 6/19/2008

Aaron Erickson Updates i4o (Indexes for Objects) to Support Plain Old CLR Objects (POCOs)

According to Aaron, i4o Release 0.92 Beta 2 of June 8, 2008 “addresses performance improvements, supports POCO, and rounds out of features needed for release.” It also has the following changes:

    • Added capabilities for dynamic indexing that allows creation and management of indexes on the fly.
    • Added support for vb string comparisons in the expression evaluator.
    • Added unit test suite (>90% code coverage)

Added: 6/19/2008 Edited: 6/23/2008

Soumitra Sengupta: SQL Server Data Services Targeting Sprint 3 Update in a Week or Two

Recovered from Orlando’s heat and humidity, Soumitra posted SSDS at TechEd 2008 on June 18, 2008. The post primarily chronicles happenings at the two Tech*Ed 2008 conferences, which others on the team covered earlier. The interesting item in his postblog was the following:

On the execution front, we are close to finishing Sprint 3.  We are now in ASK MODE for bug fixing - which means we need explicit permission from shiproom to take a fix.  Should be done with this in a week or two.  I will post the new feature set as soon as we release to operations.  Will be back when that happens. [Emphasis added.]

In the meantime, I’m waiting for the docs to try full-text search, which was part of Sprint 2. It’s not over until … the docs are done.

Added: 6/18/2008 1430 PDT

David Ebbo: Updated ASP.NET Dynamic Data Core Bits Moved from MSDN Code Gallery to CodePlex

David’s ASP.NET Dynamic Data on CodePlex post of June 18, 2008 announces that ASP.NET Dynamic Data’s “core” components have moved to Dynamic Data Runtime and Templates 5-23a on CodePlex’s aspnet project pages. He comments that:

Once Framework 3.5 SP1 officially ships, there will no longer be a need for this.  Note that for all practical purpose, this update is identical to what the final release will be in SP1.  We are now completely locked down, and have not made a change in 3 weeks.  It just takes a little more time for the whole VS SP1 stack to finish up and be out the door. [Emphasis David’s]

David Ebbo: ASP.NET Dynamic Data Extensions and Samples Added to CodePlex

The same ASP.NET Dynamic Data on CodePlex post of June 18, 2008 announces the availability of ASP.NET Dynamic Data Extensions from CodePlex. This is an upgrade to the Dynamic Data Samples, which remain available for download.

Here’s David’s description of the Extensions and Samples contained in the 1.4 MB .zip file:

[T]hese Extensions are basically a big VS solution that contain both a library of new features (Microsoft.Web.DynamicData.Extensions.dll), and a couple web sites that show them in action.

  • It gives us a place to experiment with new features that we didn't have time to put in SP1.  Some of those will eventually make their way into the next version of Dynamic Data, while others are likely to remain samples.  Obviously, we'd love to get feedback on those (the forum is the right place for that).
  • It lets us address some issues that are in the SP1 release and couldn't be fixed in time.
  • It has some great samples for Dynamic Data users to look at and learn how to achieve various results.  Note that a few of the samples that were previously separate are now included in there (e.g. Scott Hunter's DbImage sample).

The 'Extensions' project is very much work in progress, and we are actively adding things to it.  So you should expect to see fairly frequent updates on CodePlex.

And the “official” description on CodePlex:

The Dynamic Data Extensions is buildable sample that contains many of the new ideas we are thinking about building into Dynamic Data version 2.0. This project is available in source format and builds a Microsoft.Web.DynamicData.Extensions.dll that can be used to add this new functionality into an existing Dynamic Data website.

Here are some of the items you will find in the project:

  • Have fields in the control that display images from the database
  • Support for Insert pages grabbing their default value from filters
  • Support for Astoria
  • Support for binding to plain CLR objects
  • Support for ObjectDataSource
  • Localized displayname and description attributes
  • Add metadata to objects at runtime
  • Advanced filters (autocomplete, cascading)
  • FieldTemplate for Enum columns

Important: To test the Extensions library’s features, compile DynamicDataExtensions.csproj to create the assembly, and then compile and run the DynamicDataExtensionsSamples.sln project to display a page that explains and displays an example of each extension.

Scott Hunter Updates ASP.NET Dynamic Data DbImage Sample

Scott originally posted his Sample for Displaying Images from the Database using Dynamic Data on January 14, 2008 and announced that he updated it to the current ASP.NET Dynamic Data version (5-23a preview) in his Dynamic Data DbImage Sample Updated post of June 17, 2008.

The updated version is included in the ASP.NET Dynamic Data Extensions package on CodePlex described above and available as an independent download here. Scott says the updates include these changes:

  • Fixed an issue that caused DbImage not to work when the primary column for the table is a GUID.
  • Added support for compound primary keys (primary key that is more then one column in the table).
  • Added support for Entity Framework (previous release would display images in Entity Framework but fail to update them).
  • Added a helper method to the sample that disables partial rendering for UpdatePanels when the DbImage type is detected so images render correctly.

Here’s a capture of half of the Categories EntitySet with modified Site.css styles:

Ryan Dunn Starts a Working with Objects in SQL Server Data Services Series

Ryan’s Working with Objects in SSDS Part 1 of June 17, 2008 describes a process for overcoming a problem with missing xsi:type declarations when serializing objects in the Plain Old XML (POX) format used by the REST protocol of SQL Server Data Services (SSDS). He noted the problem in his earlier Serialization in SSDS post of May 28, 2008.

Here’s an example of a serialized Northwind Order entity with the required xsi:type=”x:dataType” attributes generated by the sample code for my forthcoming Visual Studio Magazine article:

<Order xmlns:s="http://schemas.microsoft.com/sitka/2008/03/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.w3.org/2001/XMLSchema">
  <s:Id>Ord_1000055</s:Id>
  <OrderID xsi:type="x:decimal">10302</OrderID>
  <CustomerID xsi:type="x:string">SUPRD</CustomerID>
  <EmployeeID xsi:type="x:decimal">4</EmployeeID>
  <OrderDate xsi:type="x:dateTime">1996-09-10T00:00:00</OrderDate>
  <RequiredDate xsi:type="x:dateTime">1996-10-08T00:00:00</RequiredDate>
  <ShippedDate xsi:type="x:dateTime">1996-10-09T00:00:00</ShippedDate>
  <ShipVia xsi:type="x:decimal">2</ShipVia>
  <Freight xsi:type="x:decimal">6.2700</Freight>
  <ShipName xsi:type="x:string">Suprêmes délices</ShipName>
  <ShipAddress xsi:type="x:string">Boulevard Tirou, 255</ShipAddress>
  <ShipCity xsi:type="x:string">Charleroi</ShipCity>
  <ShipRegion xsi:type="x:string"></ShipRegion>
  <ShipPostalCode xsi:type="x:string">B-6000</ShipPostalCode>
  <ShipCountry xsi:type="x:string">Belgium</ShipCountry>
</Order>

(The article is the “Test-Drive SQL Server Data Services” cover story for the July 2008 issue.)

I had the same problem as Ryan, so I used LINQ to XML’s functional construction rather than an XmlSerializer to generate the POX from a SqlDataReader.

Ryan’s new approach is to create a generic wrapper (SsdsEntity<T>) for arbitrary Plain Old CLR Objects (POCOs). Ryan observes that the limitations of his approach are:

    • We are limited to the same datatypes that SSDS supports.  This also means nested objects and arrays are not directly supported.
    • We have lost a little of the 'flexible' in the Flexible Entity (the E in the ACE model).  We now have a rigid schema defined by SSDS metadata and T public properties and enforced on our objects.

Ryan promises in his next post to “attempt to address some of those limitations and … introduce a library that handles most of this for you.”

Off-Topic: Google App Engine Has Serious Reliability Problems

According to TechCrunch’s June 17, 2008 Google App Engine Goes Down and Stays Down post:

Google hasn’t responded yet to a request for comment, although they did post a brief message on the Google Groups site for App Engine:

We’ve experienced several outages during the past 12 hours, the most recent of which started at 6:30am PDT and is still ongoing. During these outages, a significant percentage of requests resulted in errors. The errors are related to usage of the Datastore. We’re working hard to determine the cause of these outages and will continue updating as we make progress.

Nothing on the Google App Engine blog yet.

Stuff like this tends to make developers nervous about adopting a new platform.

Update: It’s back up!

Jesse Robbins’ Service Monitoring Dashboards are mandatory for production services! post of June 17 on O’Reilly Radar makes the following suggestions:

  • If you launch a platform that people pay you money for, you need to have a real time service dashboard. Ideally this should be decoupled from the rest of your infrastructure.
  • Don't rely on platforms that lack service monitoring dashboards for production.

Don Dodge, leader of Microsoft’s Emerging Business Team, posted Amazon, Twitter, Disqus down. Do you really want your data in the cloud? on June 7, 2008.