Showing posts with label Entity Framework SP1 Beta. Show all posts
Showing posts with label Entity Framework SP1 Beta. Show all posts

Sunday, July 13, 2008

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

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

Comparison of Entity Framework and LINQ to SQL Projects Using a 120-Table Database

Kristofer Andersson of Huagati Systems, Bangkok, is in the process of developing an airline passenger reservation system (APRS) example and has posted a database diagram and T-SQL DDL script to create the 120 tables of its data model in his Data Model - Basics - Part 10 - Overview #2 and SQL-DDL script post of June 29, 2008.

I created the database in a local SQL Server 2005 Express instance and wrote simple LINQ to SQL and ADO.NET Entity Framework (EF) projects to compare the characteristics of the two data access layer approaches. Tests showed that it took 24 times longer to initialize the EF than the LINQ to SQL version (9.426 vs. 0.394 seconds).

Precompiling the view with a T4 template from the ADO.NET Team’s How to use a T4 template for View Generation post reduced the initialization time to 2.063 seconds, which is still about five times longer than LINQ to SQL. However, a substantial workaround is required to prevent an exception when running the EF project from its Release (or Debug) *.exe file. See my Comparison of Entity Framework and LINQ to SQL Projects Using a 120-Table Database post of July 12, 2008 for more details.

Added: 7/13/2008

Charlie Calvert Continues LINQ Farm Renaissance with More on Set Operators

Charlie’s LINQ Farm: More on Set Operators post of July 12, 2008 provides “simplified examples of how to use each of the operators:” Union, Intersect, Distinct, and Except. “[A]nd then ends with a more complex example that shows how the operators might be used in a real world setting.”

Added: 7/13/2008

Guy Burstein Delivers EntityDataSource Screencast from Microsoft’s Silverlight Streaming Site

Guy’s ‘EntityDataSource Screencast – Hosted on Silverlight Streaming post of July 12, 2008 demonstrates how to use the ASP.NET EntityDataSource. The associated How To: Host Your Screencasts on Silverlight Streaming post of the same date is an illustrated tutorial for taking advantage of Microsoft’s free Silverlight Streaming service.

Added: 7/13/2008

Mike Flasko Alex James Promotes ADO.NET Data Services’ Uniform Interface with Varying Data Source Schemas

Mike Alex says in Using the Uniform Interface Exposed By Data Services of July 11, 2008:

In some of our past posts, we've discussed one of the benefits of data services is that the interface to such a service is uniform.  This means that how you interact with each service (issue a query, insert a new entity, etc) is the same across all services regardless of the schema being exposed.  This uniform interface leads to one of the value propositions of data services, which is the ability to create reusable code for service consumption.  That is, one can now write reusable client libraries, LINQ providers, app/UI components, widgets, etc that are able to work across any data service.

Hopefully, the preceding will apply to the promised unified client library for SQL Server Data Services.

Added: 7/13/2008 Updated 7/21/2008: Attribution error

Use the ASP.NET Cache for LINQ to SQL Generic Lists

J Sawyer, a Microsoft developer evangelist in Houston demonstrates a Cool way to do ASP.NET Caching with Linq with C# and VB in his detailed post of July 11, 2008. I haven’t tried it, but the technique should apply equally to Lists created from Entity Framework’s ObjectContexts.

Added: 7/13/2008

Pablo Castro Responds with His Software Development Meme

Julie Lerman tagged me and I tagged Pablo. Here’s his Software Development Meme of July 10, 2008.

I notice Pablo included SQL in his list of programming languages he has used. Neither Julie nor I included SQL (which we both use constantly) in our lists. I’ve never thought of SQL as a programming language. I’ve always considered SQL as a set-based data manipulation language, although T-SQL stored procedures probably qualify it as a PL. What’s your take?

Added: 7/13/2008

Maíra Wenzel Starts ASP.NET Dynamic Data - Tips and Tricks Series

Maíra’s first episode, ASP.NET Dynamic Data - Tips and Tricks #1 of July 11, 2008, covers the dreaded The control 'DataSource1' does not have a TableName property and a table name could not be inferred from the URL exception.

Added: 7/13/2008

Samuel Jack Uses a Hydraulic Analogy for Reporting Progress of and Canceling LINQ Queries

His Reporting Progress During LINQ Queries of July 7, 2008 and Canceling Long-Running LINQ Queries of July 10 use “LINQ Pipeline Monitors,” which Sam analogizes as:

One way to think of LINQ queries with sequences is as a pipeline, or an oil refinery. You have the data source (often a collection) acting like the oil well, but producing items. Items flow along the pipeline (think of the "."s in the expression as the pipe). Some items are removed from the pipeline by filters - Where clauses; some items are converted to other products - Select clauses; finally, just as oil is cracked, and graded into gasoline and diesel etc. items in LINQ queries are often grouped and sorted. In oil pipelines there are also flow meters, measuring how much oil is going through the pipes. If we can create the equivalent of a flow-meter for LINQ queries, then we've got our means of reporting progress.

Having been in the petroleum flowmeter business for many years (in an earlier avatar), the analogy appealed to me.

Added: 7/13/2008

Tech*Ed 2008 IT Pro Session DAT251: Introduction to SQL Server Data Services (Video)

From the session’s description:

Cloud computing offers many benefits to business customers looking to increase operational efficiencies, lower operational costs and/or move to a Software as a Service (SaaS) model. This session provides an overview of Microsoft SQL Server Data Services (SSDS) and walks through on-boarding and typical usage scenarios to show how SSDS brings the power of scale-free storage, distributed computing, and reliable data processing to new and existing business solutions. Speaker: Soumitra Sengupta.

For more details and a link to the one-hour video segment: Tech*Ed 2008 IT Pro Session DAT251: Introduction to SQL Server Data Services (Video).

Alex James on Entity Framework v2 Design: Query Caching

Alex’s Transparent Caching Support in the Entity Framework post of July 9, 2008 lays out the design of a proposed query caching implementation. From the introduction:

Entity Framework can be extended to handle data caching in a transparent way, so that any application using it can take advantage of caching with little or no modification. In Entity Framework V1 it is possible to implement transparent caching using a custom provider as demonstrated in EFCachingProvider sample (TBD). We are considering adding caching as a first-class concept in Entity Framework V2 so that it will no longer be necessary to use a wrapper provider approach.

The design caches queries, not EntityObject instances, so the queries can be reused.

Steve Naughton Starts a ASP.NET Dynamic Data Series for Custom Pages

Steve concludes that there are three now four types of ASP.NET Dynamic Data custom pages:

  • Standard Custom Page based on an existing PageTemplate and customised in the DynamicData\CustomPages folder.
  • A completely Custom Page again in the DynamicData\CustomPages folder.
  • Standard ASP.Net Page with Dynamic Data features added to take advantage of the FieldTemplates.
  • Added 7/13/2008: A DetailsView and a GridView using Validation Groups

Following are posts with instructions and sample code for the first two four types:

I’ll update this post when Steve completes Part 3.

Updated: 7/13/2008

David Hayden Demonstrates LLBLGen Pro New LINQ to SQL Templates with an Update Model Feature

Entity Framework has an Update Model from Database feature but LINQ to SQL doesn’t (and probably never will.) Dave’s LLBLGen Pro LINQ To SQL Templates with Model Refresh from Database - O/R Mappers post of July 9, 2008 explains the benefit of the template’s “update model” feature:

The attraction to using something like the LLBLGen Pro Designer instead of the Visual Studio 2008 LINQ To SQL Designer with LINQ To SQL is that the LLBLGen Pro Designer will pick up changes to the database and update the model accordingly. For very few tables this is not a big deal, but as the number of tables grows and you have DBA's making changes to the database schema it is very easy to get your model out-of-sync with the database. With LLBLGen Pro you can just refresh the catalog and it will pick up those changes for you. With the LINQ To SQL Visual Designer in Visual Studio 2008 I don't know of a real easy way to find those changes and update your model.

And demonstrates how to use it.

Jonas Stawski: Use the Code-Generated Initialize() Method to Detach and Initialize Each Entity

Jonas is “working on an article on how to use LINQ to SQL in an N-Tier environment with ASP.NET (without WCF),” so he needs to detach and reinitialize each entity. His LINQ To SQL Generic Detach post of July 9, 2008 explains a simple approach to doing the job.

Jonas (an MVP) promises to post a notice when the article is published.

Sprint 3 for SQL Server Data Services Will Add Several New Features

An e-mail from the SQL Data Services (SSDS) team dated July 8, 2008 announces that Sprint 3 will add support for Blobs, timestamp versioning, ETag, HEAD, If-Match, Accept and a new content type when the latest update goes live.

Get more details in Sprint 3 for SQL Server Data Services Will Add Several New Features of July 9, 2008.

Matt Warren Surfaces with Part 10 of His LINQ: Building an IQueryable Provider Saga

After a six-month hiatus, Matt posted a very lengthy LINQ: Building an IQueryable Provider - Part X chapter on July 8, 2008. Topics covered are:

  • Grappling with GroupBy and Aggregates
  • The GroupBy Operator
  • Aggregate Binding
  • Aggregate Rewriting
  • Taking it for a Spin

As usual, a C# tour de force with downloadable source code.

Elisa Flasko’s “Achieve Flexible Data Modeling With The Entity Framework” Article in MSDN Magazine for July 2008

Elisa’s “Achieve Flexible Data Modeling With The Entity Framework” is an overview of the Entity Framework and Entity Data Model that will be distributed with Visual Studio 2008 SP1.

The blurb says “Here the author answers questions regarding the Entity Framework and provides an understanding of how and why it was developed” and the article covers:

    • The philosophy behind the Entity Framework
    • The Entity Data Model
    • Querying, mapping, and n-tier development

Eric White Posts Updated LINQ to XML Code for the Open XML SDK

Eric describes is Open XML SDK and LINQ to XML post of July 8, 2008 as follows:

In this post, I’m presenting some code that uses the Open XML SDK and LINQ to XML to query an Open XML document. I’ve posted on this before, but this version is cleaner and smaller. It also is an example of code written in the functional style.

The most common need is to retrieve the paragraphs of a word processing document. But I've also had the need to dig into a spreadsheet, and get the data out for a row, a set of rows, or all the cells in a column. You can think of the code presented here as a (very) small library on top of the Open XML SDK.

LINQ for PHP Clone Sighted

Mike Borozdin asks Is PHPLinq As Cool As Real LINQ? in his post of July 4, 2008. Unfortunately, Mike says the answer is “No” because PHPLinq’s query keywords aren’t part of the language. They’re strings.

Alternative Approaches to Cascading Deletions in LINQ to SQL

“Salyse” analyzes various approaches to implementing cascading deletions on the client or server side in his “Cascading Deletes in LINQ to SQL” article of July 7, 2008 for the Code Project.

Phani Raju Analyzes 1:1 Associations in ADO.NET Data Services

Phani’s Working with Associations in ADO.NET Data Services Beta 1 post of July 2, 2008 provides a detailed analysis of managing 1:1 associations in Astoria.

He promises that his next post will cover the more common 1:n associations.

(Phani is a new arrival on the Astoria team; his previous position was a Microsoft product support specialist (PSS). Thanks to the Astoria Team for the heads up on the blog.)

Live Demo of Custom Pager Implementation for LINQ to SQL

Muhammad M. Mosa Soliman’s Building Custom Paging with LINQ, ListView, DataPager and ObjectDataSource, Different Paging Method post of July 8, 2008 combines techniques from Justin Etheridge’s Efficient Paging in SQL Server 2005 and Kevin Hazzard’s Efficient Paging in SQL Server via LINQ post and provides source code and a live demo of his interpretation.

Steve Naughton Continues His Permutations and Combinations of the FileImage_Edit FieldTemplate

Steve’s Dynamic Data: Part 2 - FileImage_Edit FieldTemplate of July 7, 2008 implements these new ideas:

  1. Image Aspect Ratio lock, keeping the proportions of the image the same when resized.
  2. Doing the same as DynamicDataFutures disabling EnablePartialRendering when the FileImage is in an Edit or Insert page.

Microsoft’s Live Expo Classifieds Database Bites the Dust; Is Google Base Next?

Online classified advertising databases are having a tough time competing with ClickZ’s Craigslist Rivals Struggle to Succeed in Web Classified Space post of July 7. The article says Google Base “garnered about 743,000 unique visitors in May compared to Craigslist's 26.7 million, according to Nielsen Online.” I wrote about what became Live Expo and Google Base during their gestation period (see Windows Live "Fremont" vs. Google Base Classifieds) of November 29, 2005.)

Microsoft will terminate Live Expo on July 31, 2008.

Google shut down it’s Froogle shopping service in April 2007. The http://froogle.google.com now displays an anemic Google Product Search page. URL Perhaps Google should call it quits for Google Base, too.

David Robinson Cooks Concurrent Data Access and Concurrency in Batch Updates Best Practices Soup

Dave’s Best Practice - Take Advantage of Concurrency post of July 6, 2008 uses the term concurrency in an uncommon context: Concurrent CRUD operations against the same authority by multiple front ends. His summary:

  • Multithread your SSDS calls when appropriate
    • Use Asynchronous access patterns
    • Helps combat latency
    • Many front-end servers able to handle many requests
  • Things to watch out for
    • SSDS Supports Simple Concurrency Today
    • Multiple entity updates need to be managed by your application
    • No support for batching today, but its coming

Friday, May 23, 2008

Is the ADO.NET Team Abandoning LINQ to SQL?

Updated 5/23/2008 at the end of the post.

Danny Simmons' Why use the Entity Framework? post includes an "Entity Framework vs. LINQ to SQL" topic that lists the following advantages of Entity Framework (EF) over LINQ to SQL:

  • Full provider model with support for multiple RDBMSs, including SQL Server Compact.
  • Not tied to a one:one relationship between entities and database tables.
  • Support for Table per Class and Table per Concrete Class hierarchy models.
  • Support for entity-splitting and complex types (also called value types)

Missing from this list are, for starters:

  • Default support for serializing complete object graphs.
  • An out-of-the-box multi-tier story for SP1.
  • Support for SQL Server Compact 3.5 SP1 in the Object/Relational Designer.

I had expected LINQ to SQL SP1 to support bidirectional serialization for WCF service applications with SP1's updated DataContractSerializer. However, the Object/Relational Designer's Serialization property still has None and Unidirectional options only. This fix would have taken minimal development and test time. You can accomplish this yourself but refreshing the data model requires adding [DataMember] attributes by hand to Association classes that create cyclic references.

LINQ to SQL has a much lighter footprint than EF, which makes it a better match for applications that use SQL Server Compact (SSCE) 3.5 SP1 and later. Support for SSCE by SqlMetal.exe arrived just in time for VS 2008 RTM but not by the designer. Surely there was plenty of time between VS 2008 RTM and SP1 Beta to work out this fix.

I also was looking forward to an early version of the mini connectionless DataContext that Matt Warren promised, as noted in my Changes Coming to LINQ for SQL post of just less than a year ago.

Compare LINQ to SQL SP1's New Features with Other ADO.NET Members

According to the ADO.NET Team's What's New in the SP1 Beta for LINQ to SQL? post of May 14, 2008, the following tweaks are what's new:

Across the LINQ to SQL we have made numerous bug fixes, better SQL translation for queries comparing nullable columns in Visual Basic, and support both in the runtime and the designer for SQL Server 2008.

New SQL Server 2008 Support includes:

  • Support for connecting to SQL Server 2008 databases in Server Explorer
  • Drag & drop tables in SQL Server 2008 databases from Server Explorer
  • Support for the following new types: Date, Time, DateTime2, DateTimeOffset, Filestream

SqlClient class members contain the majority of SQL Server 2008 support modifications and the SqlClient update is required to deliver Katmai support for SqlDataReader 3.5 across the entire Microsoft product line.

EF and the Entity Data Model Designer received a raft of new and improved features, as did ADO.NET Data Services (Astoria), which turned into a framework between November 2007 and May 2008. Astoria currently is staffing up for v2, as evidenced by their Interested in working on the ADO.NET Data Services Framework (aka "Astoria") or XML? post of May 17, 2008.

It's obvious to me that only trivial resources were devoted to LINQ to SQL in the post-RTM period.

Is LINQ to SQL a Legacy Data Layer?

If Microsoft intends to end-of-life LINQ to SQL, the ADO.NET team should notify .NET developers. In the meantime, I'm adding the following caveat to my reasons to choose EF over LINQ to SQL:

  • Entity Framework is Microsoft's strategic data access layer. LINQ to SQL has [almost | already] gained legacy status due to lack of attention from the Data Programmability group.

Update May 23, 2008: Andres Aguiar agreed with my conclusion in his comment to this post, but stated:

The Data Programmability Team never owned LinQ to SQL, it was owned by the C# team. That's why we have two O/R mappers, both teams wanted to ship theirs.

The Data Programmability team gained ownership of LINQ to SQL from the C# team about the time that Tim Mallalieu of SQL-DP took over program management from Dinesh Kulkarni, as Dinesh mentioned in his October 15, 2007 LINQ to SQL: What is NOT in RTM (V1) swansong from the LINQ to SQL team. (That's the post containing the source of the no "out-of-the-box multi-tier story" quote above.)

Tim doesn't qualify as a "great communicator." The last post to his blog was Databinding with ADO.NET Entity Framework is dated November 11, 2006. According to his LinkedIn profile, he's still employed by Microsoft as a Lead Program Manager.

Julie Lerman's Demurrer

Julie disagrees in her Damien Guard joins the LINQ to SQL team as a developer post of May 23, 2008. She says, "I have even seen suggestions that LINQ to SQL was intentionally cobbled and done so for political, not technical reasons." Me, too.

Matt Warren, the outspoken architect of LINQ to SQL, says in his Mocks Nix - An Extensible LINQ to SQL DataContext post of May 4, 2008:

LINQ to SQL was actually designed to be host to more types of back-ends than just SQL server. It had a provider model targeted for RTM, but was disabled before the release. Don’t ask me why. Be satisfied to know that is was not a technical reason. Internally, it still behaves that way. The trick is to find out how to swap in a new one when everything from the language to the runtime wants to keep you from doing it. [Emphasis added.]

(Matt gained his reputation for "telling it like it is" with his The Origin of LINQ to SQL post of May 31, 2007 which recounted the demise of ObjectSpaces in the black hole of WinFS and described his three years after the event as a "political nightmare.")

Julie interprets the hiring of Damien Guard by the ADO.NET Team as "an indication that the product will continue to evolve." I'm not so sure; Damien might have been hired to replace a dev lost to turnover in the ranks. The real money's being spent on the Entity Framework and its chief client, ADO.NET Data Services.

My thanks go to Julie for describing the original version of this post as a "deeply analytical blog post." For whatever it's worth, IANAL (I am not a lawyer) nor do I have any interest in being (or imitating) one. ;-) Full disclosure: I was a draftee on a Federal Grand Jury for a year and a half some time ago. :-(.

Thursday, May 22, 2008

VS 2008 and .NET Framework 3.5 SP1 Beta Documentation and Forum Links

The VS 2008 and .NET Framework 3.5 SP1 Beta documentation isn't searchable (for reasons known only to the Developer Division.) Mike Tulty provided some initial links in his VS 2008 Service Pack 1 - Docs and Installation post, which are included here. Following are links to additional topics related to LINQ and the Entity Framework, including (for convenience) links to forums.

ADO.NET

ASP.NET

SP1 [Beta]

Wednesday, May 21, 2008

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

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

Has LINQ to SQL Reached Legacy Status Less than Three Months after Launch?

LINQ to SQL was the only new data-access implementation to be included in Visual Studio 2008 when it "launched" with SQL Server 2008 and Windows Server 2008 in a series of "Heroes Happen Here" extravaganzas that started on February 27, 2008.

Judging from my Is the ADO.NET Team Abandoning LINQ to SQL? post of May 21, 2008, Microsoft appears to have ceased further development of LINQ to SQL, based on the lack of new and promised features in the LINQ to SQL SP1 Beta.

Added: May 21, 2008

Francois Vanderseypen Offers a Well-Documented Demo of a Web Client Software Factory Project that uses WCF, WF and LINQ to SQL

His Frameworks and directions (Kyiv presentation, May 2008) post of May 19, 2008 includes a link to download a large-scale Northwind Factory v.2.1 sample project that combines the Web Client Software Factory (WCSF) from CodePlex with LINQ to SQL, Windows Communication Foundation, and Workflow Foundation. The project, which builds a complete multi-tiered, Model-View-Controller (MVC) pattered Web site, includes a 26-page illustrated NorthwindFactory.docx documentation file. NorthwindFactory.docx is the last file in the .zip archive.

Francois's later Linq to SQL and Workflows post of May 21, 2008, casts doubt on the compatibility of LINQ to SQL data layers with the Workflow Foundation and raises other commonly blogged LINQ to SQL issues. He concludes:

All this leads somehow to the conclusion that [LINQ to SQL] was really not designed well to fit with the rest of the .Net 3.5 framework. Great idea, but not too well implemented. Let’s hope the final release of the Entity Framework (around [A]ugust with .Net 3.5 SP1) will bring some cures.

Francois works for Materialise Dental NV in Leuven, Belgum, the developer of "a range of products and services to aid dental specialists in the treatment of their patients," including "the SimPlant range of solutions for Computer Guided Implantology."

Added: May 21, 2008

Randolph Cabral Adds Business Entity Classes to His N-Tier LINQ to SQL Project

In Exploring N-Tier Architecture with LINQ to SQL (Part 4 of n) of May 21, 2008, Randolph "attempt[s] to build out the domain model and use it in our web UI layer to demonstrate how we could interact with the business entities."

Added: May 21, 2008

Ben Hall Recommends When and How to Use Stored Procedures vs. User-Defined Functions with LINQ to SQL

Ben's Linq to SQL Stored procedure vs Functions post of May 21, 2008 provides a detailed analysis of when to substitute user-defined functions (UDFs) for stored procedures in LINQ to SQL data-access scenarios.

Added: May 21, 2008

ASP.NET Dynamic Data Website Wizard Gets Major Overhaul in May 20 Update

Scott Hunter's May 20th Refresh of Dynamic Data is now Available post to the ASP.NET Forums of May 21, 2008 lists 11 significant changes to the Dynamic Data Website Wizard. An important upgrade is replacing details, edit, and insert ListView with FormView controls.

The Dynamic Data Runtime gets a few bug fixes, as well as UI and validation tweaks.

You can download the Dynamic Data Runtime and Templates from the MSDN Code gallery.

Added: May 21, 2008

Frans Bouma Red-Flags VB's Aggregate LINQ Reserved Word

According to his VB.NET: Beware of the 'Aggregate' keyword (updated) post of May 21, 2008, executing

Dim max = Aggregate o in metaData.Order Into m=Max(o.EmployeeID)

returns all Order entities and executes the Max() aggregate in the client's memory. Surprisingly, Frans reports in his update that the problem doesn't occur with DateTime or String values.

Added: May 21, 2008

Dean Whittaker Explains How to Use LINQ to SQL's DataContext Object to Recreate Test Databases

It's a common practice to mock database operations when using Test-Driven Development (TDD) to improve performance. If you don't mock the database, it's a good practice to recreate it each time your unit tests run to update it.

Dean Whittaker shows you how to do this in his Using Linq's DataContext to (re)create your database for testing post of May 21, 2008.

Added: May 21, 2008

Mike Taulty Extend's Julie Lerman's Analysis of EF Query Execution to LINQ to SQL

Mike's "When Do Queries Execute" post of May 21, 2008 extends Julie's discovery that stored procedures execute when invoked with ExecuteMethodCall() rather than when the data is needed (see below) to LINQ to SQL queries.

However, LINQ to SQL queries that invoke table-valued functions do so with CreateMethodCall(), which defers data retrieval until the data is required.

Added: May 21, 2008

Aaron Skonnard Describes the .NET 3.5 SP1 DataContractSerializer's New POCO and Cycle Capabilities

The Windows Communication Foundation (WCF) Data Contract Serializer (DCS) has two important new capbilities:

  1. Capability to serialize complete object graphs with associations that create cyclic references (a.k.a. bidirectional serialization or cycles) for services without a hack.
  2. Capability to serialize plain old CLR objects (POCOs) by removing the requirement to decorate classes with [DataContract] and [DataMember] attributes.

Aaron Skonnard takes on #1 in his DataContracts and object references post of May 14, 2008 and #2 in his detailed DataContracts without attributes (POCO support) in .NET 3.5 SP1 post of May 13, 2008. I missed Aaron's posts due to the activity surrounding release of .NET 3.5/VS 2008 SP1 Beta.

Prior to SP1, you could enable serializing graphs with cycles by setting the PreserveObjectReferences argument to true in the DCS's constructor. (Failing to do this raises an exception when the DCS encounters a cycle in the source object.)

However, you can't enable this option directly when you use the DCS with WCF in a service operation. Instead, you need to subclass DataContractSerializerOperationBehavior and override the CreateSerializer() method with the code described in Sowmy Srinivasan's seminal Preserving Object Reference in WCF post of March 26, 2006.

My LINQ to SQL and Entity Framework XML Serialization Issues with WCF - Part 1 post of October 9, 2007 and Serializing Cyclic LINQ to SQL References with WCF of October 30, 2007 cover issues with cycles in LINQ to SQL, which also apply to the Entity Data Model.

The latter post quotes a response to the System.ServiceModel.CommunicationException - The socket connection was aborted... question in the WCF forum by Microsoft's Ed Pinto:

Please be aware that there is no interop story for the preservation of object references.

I observed that "[t]he rumor is that Microsoft deliberately made it difficult to set this attribute value to discourage non-interoperable bidirectional serialization scenarios." It will be interesting to see if Microsoft has come up with an interop story to accompany SP1.

Added: May 21, 2008

Danny Simmons Updates Entity Framework FAQs

His New in version 0.5 of the FAQ… post of May 21, 2008 provides links to:

Added: May 21, 2008

Igor Ostrovsky Offers Seven Unusual Uses for LINQ to Objects

Igor is an infrequent poster but his 7 tricks to simplify your programs with LINQ entry of May 18, 2008 contains the following interesting examples:

  • Initialize an array
  • Iterate over multiple arrays in a single loop
  • Generate a random sequence
  • Generate a string
  • Convert sequences or collections
  • Convert a value to a sequence of length 1
  • Iterate over all subsets of a sequence

Thanks to Scott Guthrie for the heads-up.

Added: May 21, 2008

Matthieu Mezil Offers an Illustrated Introduction to Entity Framework with Advanced Topics

Matthieu's Entity Data Model Mapping: Beyond the Basics article for DataDeveloper.net starts by creating the requisite Northwind Entity Data Model with the Wizard, but then goes on to cover:

  • Many to many relationships
  • Entity splitting
  • Mapping with added conditions
  • Table Per Type (TPT) inheritance
  • Table Per Hierarchy (TPH) inheritance
  • Complex types
  • Create/update/delete SSDL functions
  • The SELECT SSDL function
  • Performing database operations based on views

Added: May 21, 2008

Matt Berseth AJAXifies the DetailsView of a Master/Details Web Form

Regardless of whether the page's DataGrid and DetailsView controls' data source is an ObjectDataSource, LinqDataSource or EntityDataSource, the AJAX Control Toolkit's ModalPopup with a DetailsView on an UpdatePanel improves the data editing experience.

Matt's Master-Detail with the GridView, DetailsView and ModalPopup Controls post of April 29, 2008 updates his prior version with a spiffed-up page design and now emulates saving changes to the back-end tables. Source code is available for download, and it's not much work to substitute a LinqDataSource or EntityDataSource for the ObjectDataSource.

Click here for a live demo.

If you're interested in AJAXifying DataGrids, read Matt's 7 simple steps to ajax-enable your ASP GridView

Thanks again to Scott Guthrie for the heads-up.

Added: May 21, 2008

Agnes Molnar Continues Her LINQ4SP Demonstrations

Hungarian SharePoint MVP Agnes Molnar (a.k.a. Aghy) shows her replacement for Bart DeSmet's LINQ to SharePoint implementation creating a lookup to a list in her LINQ4SP - How to create a new item with a lookup to another list? post of May 20, 2008. The post includes a link to a 02:30 silent screencast.

Ryan Hauert Updates an EF Three-Level Table per Hierarchy Entity with Stored Procs

Mapping ImportFunctions to stored procedures for updating base (Person) and inherited (Employee and Manager) types isn't a strictly intuitive process, so Ryan's Function Mapping with Inherited Types post of May 20, 2008 demonstrates the simplest approach, which is to create a single set of stored procedures for the base class and call them with wrapper functions in the SSDL file. A hitch in this process is that the wrapper functions are deleted each time you run the Update Database from Model operation.

Each wrapper changes the discriminator column value to conform to the level in the hierarchy, as discussed in the Re: Stored Procedures with Inheritance post of April 28, 2008 in the ADO.NET Entity Framework and LINQ to Entities (Prerelease) forum and David DeWitter's Entity Framework Stored Procedure Generation post of the same date..

Julie Lerman Discovers that EF Executes Stored Procs When Invoked, Not When Their Data is Needed

Her Command Execution of directly called ImportFunctions (stored procs) in Entity Framework post of May 20, 2008 explains the situation, which doesn't seem surprising to me.

ADO.NET Data Services to Add Replace Mode for Updates

In his Merge vs. Replace Semantics for Update Operations post of May 20, 2008, Pablo Castro announces that Astoria's current Merge update semantics will be complemented by a Replace option. Replace mode for the HTTP PUT method is required by the AtomPub spec.

The difference between the two modes is that Replace substitutes default property values for properties that aren't included in the uploaded message body's <Item> element, while Merge ignores missing properties. Missing links in Merge or Replace operations don't affect links on the server.

ADO.NET Team Offers Two New Entity Framework Web Casts

How Do I Get Started with the Entity Framework? (09:20)
In this introductory video, Alex James will show you how to build a simple Entity Data Model in a short amount of time.

How Do I Use the new EntityDataSource? (11:30)
In this introductory video Diego Vega will show you how to use the EntityDataSource in an ASP.NET Application.

SQL Server Compact 3.5 Runtime Bits Missing from VS 2008 SP1 Beta

SQL Server Compact 3.5 SP1 Beta and Synchronization Services for ADO.NET v1.0 SP1 Beta runtime bits didn't make it into the VS 2008 SP1 Beta package but you can download and install them from the preceding link.

Julie Lerman Takes on the Entity Framework Doubters

Julie posted this link to Bloglines citations of Danny's post in her Responses to Danny Simmons "Why Entity Framework" post of May 20, 2008.

Ironically, her post wasn't included in the Bloglines citation. (Several other cites in my Danny Simmons Answers the Frequently Asked Question: Why Use the Entity Framework? post were missing from Bloglines, too.)

Rob Conery Runs into a LINQ to SQL Corner with his Repository Model

He discovers "that if you set any Enumerable anything as a property, its Count property will be accessed when you load the parent object. This negates using any deferred loading for any POCOs, period." Yeah. That's run me nuts, too.

Update May 22, 2008: Scott Allen left a comment about Rob's preceding statement: "I'd say that requires more investigation. Doesn't sound correct." As it turns out, Scott did do some investigation and concluded that an IList<T> type change caused the overeager loading. See Rob's Not So Lazy MVC Storefront of 5/21/2008. 

Rob circumvents the problem by refactoring the MVC Storefront's Repository model, as described in his MVC Storefront: Intermission's Over, Made Some Changes post of May 19, 2008.

Update May 21, 2008: Rob clarifies the identity of his clients (the Microsoft ASP.NET team, the "community" and himself) in MVC Storefront: Client Progress Meeting of May 20, 2008, which details how the MVC Storefront project came to be at MIX 08 and his recent progress meeting with his boss, Shawn Burke.

Hopefully, it's time to go back to completing the code.

The SQL Server Data Service Team Breaks Their Silence

It's been a while since the last post from the SSDS folks. Soumitra Sengupta's What is going on at SQL Server Data Services of May 19, 2008 notes that SSDS is in the process of its second semi-monthly refresh after its introduction at MIX 08. Word on what new features, if any, the updates introduced will come some time after the refresh on May 20, 2008.

SSDS will be back in business by 9:00 AM on 5/21/2008.

SSDS documentation finally has been made public as the SQL Server Data Service Primer. The docs have some strange content, such as VS 2005 and .Net 3.0 being "recommended for Microsoft employees" to connect to SSDS. I recommend others use VS 2008 and .NET 3.5.

Update 5/21/2008: The SSDS team is Correcting an error in our documentation.

At MIX 07 the public beta was announced for July 2008. However, it's been pushed back two months to September 2008, according to Nigel Ellis's Introduction to New SQL Server Data Services: Web-Based Data Storage in a Cloud Web cast. I scheduled my Visual Studio Magazine article for the July issue to meet the original date; hopefully readers will be able to obtain a beta invitation if they aren't already "on-boarded" by July.

Mike Taulty Finds the Replacement for ADO.NET Data Services' DataWebKeyAttribute

Mike's ADO.NET Data Services and the Missing DataWebKeyAttribute post of May 19, 2008 explains that SP1 renamed it DataServicesKeyAttribute. This is consistent with the replacement of Web by Services in most class, method and property names.

If the Entity Framework back-end can't detect the table's primary key column you mus prefix the the class declaration with [DataServicesKey("ColumnName")] as mentioned in the ADO.Net Data Services Over LINQ to SQL? forum post.

Wally McClure Finds He Needs the Visual J# Redistributable to Get Meaningful Error Messages from ADO.NET Data Services

Strange, but apparently true, as Wally reports in ADO.NET Data Services in.NET 3.5 SP1 Beta1 of May 19, 2008. He promises a podcast about his Astoria experiences shortly.

Jon Skeet Gives Parallel LINQ a Workout with Nine Parallel LINQ (PLINQ) Mandelbrot Set Implementations

The Mandelbrot set is an ideal test bed for determining the efficiency of parallel processing algorithms and libraries. So Jon Skeet, C# MVP in the UK, decided to compare the performance of Parallel LINQ (PLINQ) with the Parallel Extensions (ParallelFx) with a variety of different approaches. The benchmarks are downloadable from his Mandelbrot revisited - benchmark edition post of May 18, 2008, which includes code samples and commentary.

Jon finds ParallelFx's ParallelForLoop implementation to have the best overall performance, but the PLINQ Unordered ParallelLinqInPlace approach wasn't far behind it.