Showing posts with label VS 2008. Show all posts
Showing posts with label VS 2008. Show all posts

Monday, December 22, 2008

“VS 2008 Kicks Off” and “The Road Ahead” make Visual Studio Magazine’s Top 5 Articles for 2008

My “Visual Studio 2008 Kicks Off” cover story for the January 2008 issue of Visual Studio Magazine hit second place in the Top 5 Articles for 2008 and “The Road Ahead” in the same issue made #4, according to Redmond Media Group’s .NET Insight newsletter, Vol. 9, No. 75 of December 18, 2008.

Both stories covered Microsoft’s release to manufacturing (RTM) of Visual Studio 2008 and .NET Framework 3.5 on November 19, 2007. “VS 2008: The MIA Features,” my third story in that issue, described technologies that didn’t make the RTM cut. VS 2008 SP1 and .NET 3.5 SP1 included many formely MIA features.

Following are decks for the three stories:

Visual Studio 2008 Kicks Off: Visual Studio 2008 is all about integrating new .NET Framework 3.x Web and smart-client technology, increasing developer productivity, and managing the application lifecycle. 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.

VS 2008: The Road Ahead: Microsoft was already well on its way to creating the next version of Visual Studio (code-named "Hawaii") when it released VS 2008. Learn what the future holds for .NET developers.

VS 2008: The MIA Features: Visual Studio 2008 is an ambitious new release and it includes a slew of new language features and tools that were required to get LINQ up and running by itself and with SQL Server 200x. Of course, not everything planned made it into the product. Here's a description of the elements that were pared back and what their status is now.

The other three stories in the top five were:

#1: Create a Data-Driven Messaging System by Paul D. Sheriff (October 2008)
Hard-coded messages don't scale well, and .NET's inherent error messages are user-unfriendly. Learn how to create a more scalable and user-friendly data-driven messaging system.

#3: Ask Kathleen: Understand Your Code Better by Kathleen Dollard (October 2008)
Visual Studio Team System's Code Metrics feature isn't perfect, but if you understand what it's measuring and how, you can use it to gain insight into your apps' overall complexity and to spot potential problem areas.

#5: On VB: Add Distinction to Your Code by Bill McCarthy (November 2008)
Learn how LINQ, extension methods, and lambda functions can help you add a bit of distinction, simplicity, and robustness to your code.

Sunday, August 10, 2008

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

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

Shawn Wildermuth Attacks the Reality of Data-Last Design in the Enterprise

Shawn’s Rigidity in Data Design post of August 9, 2008 is a thought-provoking essay about the validity of the ALT.NET members and Domain-Driven Development adherents contention that “that data is a top-down or at worse, bottom up design problem” and the assumption that greenfield persistence (database) schema are de riguer for most data-intensive development projects.

Shawn takes the position, with which I agree, that most data-driven development projects start with an existing database schema and a substantial amount of historical data. I estimate that nine out of ten projects that I’ve completed in the past 20 years worked extensively with existing business data on mainframes, minicomputers, and mid-range UNIX servers.

Shawn concludes:

No *rule* applies in all situations. I laud the ALT.NET guys for trying to inject better skills and tools into the process, I just rail against the ferocity of zealotry that comes in some of the message. When enterprise developers hear this, they just tune it out instead of taking what helps them and leaving the rest.

Added: August 10, 2008

Steve Naughton Adds Custom Row Rollover and Row Click Behavior to ASP.NET Dynamic Data Grid Views

His Customising GridView for Row Rollover and Click in Dynamic Data post of August 9, 2008 adds:

  • Background color change with mouse rollover
  • Row click navigation (e.g., to details view)
  • Row double-click navigation (e.g., to edit view)

to GridView controls in ASP.NET Dynamic Data projects. Steve’s prodigious output of code for customizing ASP.NET Dynamic Data projects goes far beyond what the Microsoft team has provided in documentation and blog posts so far.

Bart De Smet Offers LINQ Resources from Three of his Four Tech*Ed South Africa 2008 Sessions

Bart’s TechEd 2008 South Africa Demo Resources post of August 9, 2008 provide downloadable files and other resources from his two LINQ-related presentation and an additional Tech*Ed South Africa 2008 session:

  • DEV 305 – C# 3.0 and LINQ Inside Out
  • DEV 303 – Parallel Extensions to the .NET Framework
  • DEV 304 – Writing Custom LINQ Providers
  • MGT 301 – Next-Generation Manageability – Windows PowerShell and MMC 3.0

VS 2008 SP1 RTM Scheduled for Monday, August 11, 2008

Visual Studio 2008 Service Pack 1 will be available for download from the MSDN Subscriptions page "after August 11, 2008.”

If you have VS 2008 installed, don’t run SQL Server 2008 setup until after you install VS 2008 SP1 RTM bits.

For more information, see my VS 2008 SP1 RTM Scheduled for Monday, August 11, 2008 post of August 8, 2008.

Bill McCarthy Casts a List(Of DerivedClass) to List(Of BaseClass) with Generic Variance via an Extension Method

Bill starts his Generic variance and List(Of T) post of August 8, 2008 with:

Have you ever wanted to cast a List(Of Customer) to a List(Of BusinessBase), where Customer Inherits BusinessBase, only to find that you can't... well you can ;)

But his extension method uses reflection do it. (His post is an extension to his Inside Arrays article for in Visual Basic Magazine’s July 2008 issue.

For more information about Generic Variance see Variance in Generic Types (C# Programming Guide) article, Paul Vick’s A little update on VB10 thinking... post that says Generic Variance is on VB vNext’s radar, and Eric Lippert’s 11-part Covariance and Contravariance in C# blog series.

Don Kiely Describes Why Web Sites Running in Medium Trust Can’t Use Entity Framework v1

Don’s “Dynamic Data with the Entity Framework in Medium Trust” article for the ASP.NET Newsletter August 8, 2008 issue’s “Secure ASP.NET” column publicizes an ASP.NET Dynamic Data forum thread: Should Dynamic Data (Entity Framework model) work in medium trust?

The upshot of the thread is that the EntityDesignerBuildProvider throws exceptions the when run in medium trust on hosted Web sites. According to the Entity Framework team’s Diego Vega:

    1. The problem only affects Web Sites. Web Applications are not affected.
    2. Web Sites precompiled in full-trust and deployed to partial-trust apparently work.

Don and Diego suggest the same workarounds.

Thanks to Julie Lerman for the heads-up.

Ardenkantur Recounts Issues Using Entity Framework with Jaroslaw Kowalski’s Oracle Data Provider

His My Adventures with Entity Framework and Oracle post of August 8, 2008 describes issues with mixed-case versus upper-case table and column names, inability to specify column names in the EDMX file’s SSDL (storage) section instead of the mapping layer (MSL),  and use of ROWNUM clauses in Skip and Take operations.

The post is based on Jaroslaw’s EFOracleProvider described in his Sample Entity Framework Provider for Oracle post and available for download from under the Microsoft Public License (MS-PL), which isn’t intended for production use. However, users of commercial EF-enabled Oracle Managed Data Providers should watch out for the the problems Ardenkantur encountered in his pre-RTM test.

Pete Montgomery Demonstrates Caching the Result of LINQ Queries

In Caching the results of LINQ queries of August 8, 2008, Pete describes how to cache the result of LINQ queries that will will:

    • work for any LINQ query (over objects, XML, SQL, Entities…)
    • work for anonymous type projections, as well as business entities
    • be statically type safe (no casting required)
    • deal transparently with cache key creation
    • look syntactically like a custom query operator

He generates the unique cache key from the query expression.

Although Pete’s technique targets ASP.NET’s System.Web.Caching.Cache class, he says the approach “can be used by any .NET application or library.”

Note: Ayende Rahien (Oren Eini) has just completed a series of blog posts on distributed hash tables (DHT). His Patterns for using Distributed Hash Tables: Conclusion post of August 9, 2008 has links to the preceding eight episodes. If you’re interested in object caching in .NET, this series is a must-read.

Billy McCafferty Releases S#arp Architecture v0.7.3 Supporting ASP.NET MVC Preview 4 and NHibernate 2.0 CR 1

Billy’s S#arp Architecture: a new home, upgrades and a logo! post of August 8, 2008 announces the release of the latest version of S#arp Architecture: ASP.NET MVC with NHibernate (0.7.3), which supports ASP.NET MVC Preview 4 and NHibernate 2.0 CR1, and the formation of a S#arp Architecture Discussion Group on Google Groups.

He describes his new framework, which carries a GNU General Public License v3 license, as follows:

Pronounced "Sharp Architecture," this is a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate. The primary advantage to be sought in using any architectural framework is to decrease the code one has to write while increasing the quality of the end product. A framework should enable developers to spend little time on infrastructure details while allowing them to focus their attentions on the domain and user experience. Accordingly, S#arp Architecture adheres to the following key principles:

  • Focused on Domain Driven Design
  • Loosely Coupled
  • Preconfigured Infrastructure
  • Open Ended Presentation

The overall goal of this is to allow developers to worry less about application "plumbing" and to spend most of their time on adding value for the client by focusing on the business logic and developing a rich user experience.

Billy is the author of NHibernate Best Practices with ASP.NET, 1.2nd Ed., which is required reading for anyone developing data-driven ASP.NET projects, regardless of whether you’re using or plan to use NHibernate, Entity Framework, LLBLGen Pro, or any other .NET Object/Relational Management O/RM tool.

Kingsley Idehen: OpenLink Software Publishes White Paper about LINQ to RDF

Kingsley describes Carl Blakeley’s LINQ To RDF: Exploiting the RDF based Linked Data Web using .NET via LINQ white paper of July 31, 2008 in his .NET, LINQ, and RDF based Linked Data (Update 2) post of August 8, 2008:

The paper offers an overview of LINQ to RDF, plus enhancements we've contributed to the project (available in LinqToRdf v0.8.). The paper includes real-world examples that tap into a MusicBrainz powered Linked Data Space, the Music Ontology, the Virtuoso RDF Quad Store, Virtuoso Sponger Middleware, and our RDfization Cartridges for Musicbrainz.

OpenLink Software is the publisher of Virtuoso, “an innovative Universal Server platform that delivers an enterprise level Data Integration and Management solution for SQL, RDF, XML, Web Services, and Business Processes.”

Amirthalingam Prasanna Offers a Introductory Guide to ADO.NET Data Services

His “Creating Service-Orientated Data-Access Layers” article of Redgate Software’s Simple-Talk newsletter of July 30, 2008 is yet another tour of ADO.NET Data Services but, unlike many other Astoria articles and blogs, it includes the basic details of query interceptors and change inteceptors for implementing role-based security.

Thursday, August 07, 2008

VS 2008 SP1 RTM Scheduled for Monday, August 11, 2008

According to the MSDN Subscriptions page’s “SQL Server 2008 RTM Available for Download” topic, Visual Studio 2008 Service Pack 1 will be available for download from the page "after August 11, 2008.”

Note: My assumption is that the author of this sentence meant “on August 11, 2008 and thereafter,” not “sometime after August 11, 2008.”

The SQL Server 2008 RTM Release Note author undoubtedly anticipated that VS 2008 SP1 would RTM on August 4, as Danny Simmons did when he recorded his Daniel Simmons on Entity Framework v1! interview that .NET Rocks! released as Show #365 on August 5.

Update 8/8/2008: Danny explained the premature RTM date in his EF v1 (delivered by VS 2008/.net 3.5 SP1) is... almost... here. (And the .Net Rocks podcast announcing it is already here.) post of August 5.

For more information on installing SQL Server 2008 with or without VS 2008 SP1, see Euan Garden’s SQL Server 2008 Installation Confusion, VS 2008 Sp1 and NetFx 3.5 Sp1 post of August 7, 2008.

From the Semi-Non Sequitur Department 8/9/2008: Software Development Times published .NET 3.5 SP1 to ship this summer by David Worthington on August 8, 2008.

Saturday, May 17, 2008

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

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

Danny Simmons on Why use the Entity Framework?

My Danny Simmons Answers the Frequently Asked Question: Why Use the Entity Framework? of May 18, 2008 analyzes Danny's answer and agrees with his conclusions, as do Jon Papa, Julie Lerman, and Jonathan Carter (so far).

Added: 5/18/2008

Location of Missing ADO.NET Data Services AJAX Client Library

My "Manipulate Data in the Cloud with ADO.NET [Data Services]" story for Visual Studio Magazine's May 2008 issue mentions the ADO.NET Data Services AJAX Client Library but doesn't give its location, which is ADO Data Service AJAX Client Library on CodePlex.

For a guided tour of using the AJAX Client library, try Jonathan Carter's ADO.NET Data Services Part 6: AJAX post.

Added: 5/18/2008

Mike Taulty Duplicates My Problems with VS 2008 SP1 Beta Installation

Mike Taulty had the same problem I encountered with my first installation of the VS 2008 SP1 Beta bits: Indication of a successful install followed by no templates for ADO.NET Entity Data Model or ADO.NET Data Services. (See the "VS 2008 SP1 Beta Didn't Install on My Primary Development Machine (but Said It Did)" topic below.)

Mike's VS 2008 Service Pack 1 - Docs and Installation post of May 18, 2008 tells the gory tale.

ADO.NET Program Manager Sanjay Nagamangalam has some suggestions for three problem scenarios in this VS2008 SP1 Beta fails to add "new item - ADO.NET Entity Data Model" Item Template thread in the Visual Studio 2008 SP1 (Beta) forum.

I decided, like Mike, to start over from scratch by removing my VS 2008 RTM installation and the entire Microsoft Visual Studio 9.0 folder. I also removed the previously unremovable KB949325 and KB945855 HotFixes manually by deleting all their Registry references. Reinstalling VS 2008 RTM and SP1 Beta proceeded without a hitch and ADO.NET Entity Data Model and ADO.NET Data Services templates and libraries appeared and worked as expected.

Added: 5/18/2008

Aghy Continues Her LINQ for SharePoint (LINQ4SP) Series

The LINQ4SP - Create new list item post of May 17, 2008 describes how to create a new SharePoint list item for an AdventureWorks Products list.

Quintin Clark and Jon Udell: WinFS Contributions to Entity Framework and SQL Server 2008

My Jon Udell Interviews Quintin Clark on WinFS's Downstream Effects: Entity Framework and SQL Server of May 16, 2008 contends that Entity Framework and LINQ to SQL descend from Object Spaces, not WinFS.

There's no question, however, the WinFS was the driving force behind SQL Server 2008's filestream and HierarchicalID datatypes.

Bill McCarthy Finally Gets VS 2008 SP-1 Beta to Install

Bill describes the agonizing process he used to get VS 2001 SP-1 Beta to install in his The trials and tribulations of installing VS 2008 SP1 post of May 16, 2008. I wasn't so lucky as the following post reports.

VS 2008 SP1 Beta Didn't Install on My Primary Development Machine (but Said It Did)

My Failed VS 2008 SP1 Beta Installation Indicates Success post of May 16, 2008 describes the trials and tribulations with an install that reported success but didn't install the DDLs and templates for ADO.NET Entity Framework or ADO.NET Data Services.

I filed a Connect bug report on May 14, 2008 and enclosed a rollup of all logs. As of May 17, 2008, all I've received is the standard "Dear John" letter:

Thanks for your feedback. We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team

Update: May 18, 2008

I fixed the problem by removing and reinstalling VS 2008 RTM and SP1 Beta bits. See the earlier "Mike Taulty Duplicates My Problems with VS 2008 SP1 Beta Installation" topic.

Jim Wooley Discovers an Anomaly in VB's Anonymous Type Property Ordering

His Anonymous Type property ordering in VB post of May 16, 2008 notes that VB orders anonymous types alphabetically, while C# orders them in the sequence of declaration.

Hadi Eskandari Uses LINQ to Enhance WPF INotifyPropertyChanged Implementations

Iranian developer Hadi Eskandari describes in his Enhanced INotifyPropertyChanged post of May 16, 2008 the use of the GetPropertySymbol extension method to extract member names from a lambda expression in a PropertyChangedEventHandler that implements INotifyPropertyChanged.

Hadi's approach is based on Jafar Husain's early Symbols in C# 3.0 post of March 2, 2007.

John Papa Posts a Teaser for His Forthcoming Data Access with Silverlight 2 Book

Silverlight Consuming REST Services of May 16, 2008 explains combining REST APIs with LINQ to XML:

So raw XML comes barreling into your Silverlight application asynchronously, LINQ to XML makes it fall in line, and its bound to where it needs to go via XAML.

Sending data back via REST is also very cool. I've got that working now too. ... Interacting with REST from Silverlight applications is just one piece of the data access puzzle, but its pretty cool.

How about a source code preview, John?

Bill Wagner Has a New C# Book in the Works

His Rough Cuts available for "More Effective C#" post of May 16, 2008 says:

I've been working quite a bit on my next book:  More Effective C#. It's getting closer, and it's now available on Rough Cuts.  Rough Cuts is a Safari Books Online service that provides you with pre-publication first access to upcoming books.  Chapters 1 & 2 are up right now. 

You can see more about the Rough Cuts program here: http://safari.informit.com/roughcuts

More Effective C# is here:  http://safari.informit.com/9780321580481

Alex James Explains the Pros and Cons of the Multiple EntitySets per Type (MEST) Model

Multiple EntitySets per Type is a model that few, if any, other object/relational management (O/RM) tools offer. In his MEST - What is it and how does it work? post of May 16, 2008, Alex describes how MEST works graphically by deriving GoodCustomer and BadCustomer entities from a base Customer entity.

He also describes the morass you enter when the GoodCustomers and BadCustomers EntitySets have two-way associations with Orders, OrderLines and Products EntitySets. Alex says:

    • The EntityFramework in V1 just can't handle this ambiguity.
    • Going forward we are trying to work out how to handle this situation gracefully.
    • Still today the only workaround is to duplicate the whole graph.

Bob Beauchemin Explains VS 2008 SP1's Enhancements to ADO.NET Sync Services for Change Tracking with SQL Server 2008.

Bob's SQL Server 2008 Change Tracking and Sync Services ARE made for each other... in VS2008 SP1 post of May 16, 2008 is a paen to a new feature of VS 2008's Sync Services Designer:

Visual Studio 2008 SP1 Beta contains direct support for using SQL Server 2008 Change Tracking. When you use ADO.NET 1.0 Sync Services with a SQL Server 2008 database, the Sync Services designer (that's Add/New Item/Local Database Data Cache) adds a checkbox that allows you simply to "Use SQL Server Change Tracking". No extra triggers, no tombstone tables, change tracking does it all for you. Visual Studio generates some scripts to enable change tracking at a database level and at a table level for the tables you select.

He then goes on to discuss generated code to warn users who don't resync frequently enough and SQL Server Books Online's recommendation to use Snapshot isolation with this feature.

This feature is likely to enhance SQL Server 2008's participation in Live Mesh projects.

Dinesh Kulkarni Continues his LINQ to SQL Server Tips Series

LINQ to SQL Tips 7: Using stored procs that return multiple results of May 16, 2008 is the latest episode. Following are links to earlier posts:

The mystery is where are Tips 5 and 6?

Om Malik Presenting Cloud Computing Conference June 25, 2008 in San Francisco

A Web technology isn't real until it has its own conference. Om's Structure 08 Conference subtitled "Put Cloud Computing to Work" will be held at San Francisco's new Mission Bay Conference Center of June 25, 2008.

Among the speakers will be Werner Vogels (Amazon VP, CTO and keynoter), Microsoft's Debra Chrapaty (Microsoft Corporate Vice President, Global Foundation Services), and Christophe Bisciglia (Google Sr. Software Engineer).

Why should we ‘Refresh the Net’? is a sidebar that purports to offer "more about the topics and issues at Structure 08 from community thought leaders."

Saturday, February 23, 2008

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

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

Alex James Posts a Teaser About Entity Framework Support for Associations with Payloads

As Alex mentions in his Associations with Payloads post of 7/24/2008, Entity Framework (EF)automatically creates a many:many association instead of an entity for a table that consists entirely of two (or more) foreign key fields.

If you add payload field(s) to the table, such as Quantity [,UnitPrice, Discount, etc.], EF treats the table as an entity with one:many and many:one associations with its related tables.

Alex says:

It turns out however that with a little jigger pokery in the CSDL, MSL and SSDL it does support them, sort of.

However he doesn't provide the "jigger pokery," which I assume is Kiwi for "hack" or the like, but says it's coming in the next post. Since his last preceding post was February 11, you might be in suspense for a couple of weeks.

Added: 2/24/2008

Update 2/26/2007: See LINQ and Entity Framework Posts for 2/25/2008+ for the outcome.

Scott Hanselman Uses LINQ to XSD as an Example of How Microsoft Projects  Appear to be Abandoned

In LINQ to Everything - LINQ to XSD adds more LINQiness of February 22, 2008, Scott says he hears the following about many small Microsoft projects:

"Is _______ dead? I haven't heard anything in a month from _____ team's blog! It must be dead.

and then goes on to describe the benefits of augmenting LINQ to XML with LINQ to XSD using the arcane Open Financial Exchange (Ofx) XML schemas. (Microsoft, CheckFree, and Intuit initiated Ofx, which appears to have a semi-active blog.).

I suggested in a comment:

Another way to indicate a project isn't dead is to respond to questions about its status in the appropriate MSDN forum.

I requested the status of LINQ to XSD for .NET 3.5 RTM in a LINQ Project General forum Status of LINQ to XSD for RTM? on November 17, 2007. Two others seconded my request.

Not a word from the XML team.

I'm trying again with a status request for Shyam Pather's LINQ to Stored XML implementation, but I'm not optimistic about the result.

See the "LINQ to XSD Alpha 0.2 for VS 2008 RTM Is Available for Downloading" topic below for more details and background on the new release.

Added: 2/23/2008

Jim Wooley Uses LINQ to XML to Query All Shakespeare Plays Very Quickly

Jim's Querying the complete plays of Shakespeare using LINQ to XML post of February 22, 2008 describes his quest to find with LINQ to XML the fifty characters (SPEAKERS) in 37 plays having the most LINEs. The total size of the 37 files he concatenated into a single collection of XElements is about 7.75 MB.

Jim says:

The amazing thing with this process, running all three queries here, including the one which loads the full XML from the various files takes less than a second. I haven't had time to do a full performance test, including memory load, but the initial results are quite impressive! [Emphasis added.]

I agree.

Added: 2/23/2008

LINQ to Objects and LINQ to XML Videos from Tech*Ed 2007 Developers Barcelona Start with Disclaimer

Charlie Calvert's Video of Luke Hoban's In-Depth Look at C# 3.0 post of February 22, 2008 points to videos of these two presentations:

These are the first videos of presentations from Microsoft events that start with a disclaimer. Fortunately, you don't need to choose the "I have read the disclaimer and agree to be bound by it" option to watch the segment. I'm waiting for the first conference that requires agreement to a disclaimer as a condition of registration.

Added: 2/23/2008

Scott Guthrie: Silverlight 2.0 Beta 1 Will Support LINQ to XML

Scott's First Look at Silverlight 2 post of February 22, 2008 says that his team is "shortly going to release the first public beta of Silverlight 2" and notes that:

It also includes LINQ and LINQ to XML library support (enabling easy transformation and querying of data), as well as local data caching and storage support.  The .NET APIs in Silverlight are a compatible subset of the full .NET Framework.

It's amazing that the Silverlight team has been able to incorporate such an amazing array of new features in such a small package:

The Beta1 release of Silverlight 2 is 4.3MB in size, and takes 4-10 seconds to install on a machine that doesn't already have it.

Added: 2/22/2008

Jon Skeet Offers a Animated LINQ to Objects Visualizer

Jon's Visual LINQ: Watch query expressions as they happen! post describes an animated WPF project that displays the dynamics of LINQ to Objects query processing. You can download the source code, watch a screencast, or both.

Added: 2/22/2008

LINQ to XSD Alpha 0.2 for VS 2008 RTM Is Available for Downloading

Shyam Pather, Dev Lead for the XML Team, says in his LINQ to XSD Alpha 0.2 post of February 21, 2008:

I’m happy to announce that today we are re-releasing the LINQ to XSD Preview Alpha 0.2 for Visual Studio 2008. The previous preview release of LINQ to XSD targeted Beta 1 of Visual Studio 2008 but did not work on later builds. Many of the people who originally downloaded and tried the LINQ to XSD Preview Alpha requested an update for the final release of Visual Studio 2008 – this release is it. You can download it from here.

I'm one of the one of "the people who originally downloaded and tried the LINQ to XSD Preview Alpha" who "requested an update for the final release of Visual Studio 2008." See my LINQ to XSD Redux and LINQ to Stored XML Coming post of December 4, 2007 (Updated 1/14/2008) for more background on the original development of LINQ to XSD by Ralf Lammel.

Good news! Now what we need from the XML Team is a progress report on LINQ to Stored XML.

Added: 2/21/2008

ADO.NET Team: LINQ to SQL Support for New SQL Server 2008 Features "Coming Soon"

According to Faisal Mohamood, LINQ to SQL Program Manager, in his Coming soon to LINQ to SQL post of February 21, 2008:

Things aren’t so quiet over here on our end, even if it looks that way. The team has been busy adding features so that you will have better support for SQL Server 2008 in the future. Things we’ve been working on include support for new T-SQL data types that are being introduced in SQL Server 2008 – namely DATE, TIME, DATETIME2 and DATETIMEOFFSET, so that you can enjoy the same rich LINQ support and CUD support over data that uses many of the new types that are being introduced in SQL Server 2008.

Stay tuned and watch this blog for more on this as we get closer to releasing some of this and other new functionality!

Sounds to me like the LINQ to SQL upgrade is a candidate for VS 2008 SP1.

Added: 2/21/2008

VS 2008 SP1 Appears to be in the Works Before the Product's Official Release

The ReadMe file for SSCE 3.5 SP1 Beta for EF Beta 3 contains the following statement and admonition:

Microsoft SQL Server Compact 3.5 SP1 is the service pack release for the SQL Server Compact 3.5. SQL Server Compact 3.5 SP1 releases with SQL Server 2008 and Visual Studio 2008 SP1. [Emphasis added.]

Important:

All references to SQL Server 2008 and Visual Studio 2008 SP1 in this SQL Server Compact 3.5 documentation refer to a pre-release version of SQL Server 2008 and Visual Studio 2008 SP1. [Emphasis added.]

The SQL Server Compact Release Versions post of February 8, 2008 (updated for build 3.5.5626) contains a table with the following three latest entries for SSCE releases:

Product Name Release Vehicle Version

SQL Server Compact 3.5 SP1 Beta for ADO.NET Entity Framework Provider Beta

Download Center

3.5.5626

SQL Server Compact 3.5 SP1 Beta

SQL Server 2008 CTP6

3.5.5626

SQL Server Compact 3.5 SP1 Beta

Visual Studio 2008 SP1 Beta

 

These are the first references in official Microsoft documents about VS 2008 SP1 that I've seen. On 2/4/2008, Brian Keller said in a VSTS Forum Answer Re: When is Visual Studio 2008 SP1 coming out? post:

We haven't announced any dates around SP1. Once details become available we'll make them known but for now it's too early to say anything about the schedule.

The VS 2008 Web Development Hot-Fix Roll-Up Available that Scott Guthrie announced on February 8, 2008 isn't a service pack.

It's interesting that Microsoft is announcing a service pack for VS 2008 before the product is officially released.

Added: 2/21/2008

SQL Server Compact Edition 3.5 SP1 Beta for Entity Framework Beta 3 Is Available

Ambrish Mishra, Program Manager for SSCE, announced Download available for SQL Server Compact 3.5 SP1 Beta for ADO.Net Entity Framework Beta 3 on February 20. This is a special version (Build 3.5.5626) of SSCE SP1 Beta 1 specifically for EF Beta 3. This build is the same as that released with the current SQL Server 2008 CTP6. (See the SQL Server Compact Release Versions post of February 8, 2008 for build and release vehicles.)

Ambrish's post includes step by step instructions for creating a working Entity Data Model with the included Northwind.sdf database file.

You can download SSCE v3.5 SP1 Beta for EF Beta 3 here. Be sure to check out the ReadMe file before installing this SSCE Beta, which obviously is not fully cooked. There are 11 known issues, some of which seem to me to be serious deficiencies.

I remain curious as to why anyone would layer heavyweight EF components over a lightweight, single-user database like SSCE.

Added: 2/21/2008

Roger Alsing: LINQ to NPersist Is Progressing

Roger's More Linq support for NPersist post of February 20, 2008 describes his technique for adding LINQ support for Mats Helander's NPersist object/relational mapping tool by generating LINQ-like NPath instead of SQL queries. Mats welcomed Roger back to the NPersist project in his Roger Is Back post of January 9, 2008. NPersist is now at version 1.0.10; you can read more about it in this 200-page Inside NPersist manual (.doc format).

Here are links to Roger's earlier posts on the topic:

Download the current NPersist source code, binaries or both here.

Update 2/24/2008: Roger has LINQ to NPersist running with a Microsoft Access database because his development machine is dead, according to his Linq to NPersist to MS Access post.

Dave Longnecker Replaces Web Gallery 2.0's Custom n-Tier Data Layer with LINQ to SQL

The details are in Dave's WebGallery 2.0 #2 - HttpHandler and LINQ Data Model post of February 20, 2008. The post also includes some links to his earlier posts on LINQ:

Added: 2/21/2008

Richard Bushell: Use Timestamp Fields for Concurrency Conflict Management with the LinqDataSource Control

If you use LINQ to SQL's default value-based concurrency conflict management feature, the LinqDataSource control stores the original values in ViewState. In his The LinqDataSource and the Hidden Viewstate of 2/21/2008, Richard goes into detail about how value-based concurrency works and the value of replacing original values with a single timestamp column.

His earlier How to Update Data with LINQ-to-SQL post of February 18, delves into updating rows without bringing an entity instance into memory.

Added: 2/21/2008

Ruurd Boeke Continues His Postcompiling for Entity Framework Series

Ruurd's initial post about using PostSharp to add IPOCO interfaces to an Entity Data Model (see the "An Automatic IPOCO Implementation for Entity Framework" topic below) has turned into a Postcompiling for Entity Framework series. Here's his table of contents with current links:

Here's a link to Ruurd's Entity Framework Contrib (EFC) project on CodePlex.

Added: 2/21/2008

Julie Lerman to Present Two Entity Framework Sessions at Tech*Ed US Developer 2008

Julie's Entity Framework at TechEd post of February 19, 2008 announces that she'll present

  • Advanced Entity Framework: Entity Data Model in the Enterprise
  • .NET 3.5 Data Access Guidance

at TechEd 2008 US Developer in Orlando June 3 - 8, 2008.

Register before April 4, 2008 and save $200 off registration costs.

Don't miss her .NET Rocks! Entity Framework podcast next Tuesday, February 26.

Added: 2/20/2008

Beth Massi Demos LINQ to SQL Master/Child Forms with Stored Proc Updating

Beth's One-To-Many (Master-Detail) Forms with LINQ to SQL post of 2/19/2008 shows you how to create an Orders/OrderDetails master-detail form, save edits made with stored procedures to the entities, and eliminate associated entity and referential integrity conflict exceptions when deleting OrderDetails entities.

Beth doesn't use Northwind for the demo because she wants foreign key values to be NOT NULL and use timestamp columns for concurrency conflict management. Both good ideas, but easy to implement on a copy of Northwind.

Added: 2/19/2008

Frans Bouma Tackles Function Mapping and Local Methods in LINQ to LLBLGen Pro

Frans is closing in on his epic LINQ to LLBLGen Pro implementation in Developing Linq to LLBLGen Pro, part 13 of February 19, 2008. This episode deals with issues with invoking functions within LINQ queries that don't map to database functions.

All store-specific ADO.NET data providers must support a designated set of canonical functions defined for aggregate, bitwise, date and time, math, string and other operations. Functions invoked by members of a projection that aren't canonical functions will execute on the result set in memory but not if they're included in the query (for example, in the Where clause.)

Frans' post deals with the following specific issues:

  • Constants in the projection
  • In-memory methods/property calls in the projection
  • Mapping methods and properties as database constructs
  • Booleans in projections
  • Lambda-based function usage
  • Object creation inside projections
  • LINQ to SQL oddness

and is longer than most of my posts!

His next post, which he hopes will be the last will cover defining function mappings for RDBMSs other than SQL Server and adapting LINQ queries to use LLBLGen's prefetch paths feature.

Added: 2/19/2008

Jim Wooley Explores LINQ Queries Against Self-Joined Tables

Jim's Managing self-referencing tables with LINQ to SQL post of February 18, 2008, demonstrates how to query a table with a self-join that generates a data tree. He uses the Northwind Employees table whose ReportsTo column contains the EmployeeID of the person's boss.

Jim notes that you can't use LoadOptions to eager load the Employees set, because eager LoadOptions doesn't allow cycles (a.k.a., cyclic references.)

Added: 2/19/2008

Pablo Castro: Links and Link Expansion in ADO.NET Data Services

In his Related entries and feeds: links and link expansion post of February 18, 2008 Pablo requests input from the community on the Astoria team's approach to handling GET operations for associated entries in Atom graphs:

This write up briefly describes how we model associations between resources as Atom links and proposes a usage pattern of the atom:link element to support retrieving resource graphs in a single response. We're looking for feedback on the approach and also to get folks thinking about inlined content and whether it should be considered an extension to Atom.

Pablo refers to his earlier post, AtomPub support in the ADO.NET Data Services Framework of 2/13/2008 for background. I discussed this topic in my  Pablo Castro: ADO.NET Data Services and the Atom Publishing Protocol post of February 14, 2008, updated 2/16/2008 for Dare Obasanjo's posts on AtomPub extensions.

The two topics under consideration are:

1. Links for modeling associations between resources: Use the current link syntax:

<link rel="related" title="Customer" href="Orders(11077)/Customer"  type="application/atom+xml;type=entry" />
<link rel="related" title="Employee" href="Orders(11077)/Employee" type="application/atom+xml;type=entry" />
<link rel="related" title="Order_Details" href="Orders(11077)/Order_Details" type="application/atom+xml;type=feed" />
<link rel="related" title="Shipper" href="Orders(11077)/Shipper" type="application/atom+xml;type=entry" />

with the "starting" end of the association as the title. An alternative is a custom Atom attribute. I recommend minimizing the use of custom attributes. It would be helpful if developers using Entity Framework data sources would singularize EntityType names and End names of the 1 or 0...1 side of AssociationSets, as in the above example. Processing should retain the nouns' number.

2. Expanding links inline. Using the current $include constructs to indicate which associations to expand and include them as content within the <link> element seems appropriate to me.

Note: This may expand into an independent post after I do some additional investigation on the topic, as well as how ADO.NET Data Services fit into the Internet Service Bus that's implemented as a CTP by BizTalk Services.

Update 2/22/2008: Pablo's "Data Friction", spot-on post of February 20, 2008 cites and agrees with Jon Udell's Overcoming data friction article of the same date, which laments the need for Web screen scraping because the underlying databases aren't Web-accessible.

Ruurd Boeke: An Automatic IPOCO Implementation for Entity Framework

Ruurd's Introducing Entity Framework Contrib: Easy IPoco implementation V 0.1 of February 18, 2008 describes his Entity Framework Contrib (EFC) project on CodePlex. EFC implements the

  • IEntityWithChangeTracker
  • IEntityWithKey
  • IEntityWithRelationship

interfaces, which increase the Entity Framework's "persistence ignorance quotient" to IPOCO (Plain Old CLR Objects with Interfaces). Postsharp automatically generates and implements the three interfaces from a POCO class in IL when you build your project. However, the class must be decorated with a custom attribute.

The Postsharp folks ask:

Have you already implemented things like transaction management, logging, caching, or security? In each method, you had to write a same dozen of lines of code, right?

With PostSharp, you can encapsulate these aspects as custom attributes. You can make your own custom attributes that will really add new behaviors to your code! This is sometimes called aspect-oriented programming (AOP) or policy injection.

For more on persistence ignorance, see Danny Simmons' Persistence Ignorance: OK, I think I get it now post of June 2, 2007 and my Persistence Ignorance Is Bliss, but Is It Missing from the Entity Framework? of April 24, 2007.

LINQ to Opf3: An Implementation of LINQ for Chili Software's Opf3 O/RM

Christian Liensberger's Opf3 and LINQ support post of February 18, 2008 announces that Chili Software's Object Persistence Framework 3 (Opf3) now includes support for LINQ by adding the Chili.Opf3.Linq namespace.

Opf3 is a simple O/RM that offers a free Express Edition that maps up to eight tables to classes with a maximum of eight properties each. Opf3 supports most popular commercial and open-source databases that have ODBC or OLE DB drivers.

A single developer license with source code costs US$199; a site license is $699. A wizard plug-in that generates classes and enables customizing the autogenerated mapping is available for $99 and $349. Opf3/Wizard bundles are $249 (single) and $999 (site).

For comparison, LLBLGen Pro licenses range from €229 for a single license to €159 each for 20 or more, excluding VAT.

Charlie Calvert: LINQ Librarian

Charlie's LINQ Books post of February 17, 2008 lists published and forthcoming LINQ-related books in the following categories:

  • Books on LINQ (5 published)
  • Books that Feature LINQ (3 C#, 2 ASP)
  • Not Yet Published (8, including mine)
  • Books on the LINQ Beta (2)

The preceding lists don't include Programming the Microsoft® ADO.NET Entity Framework by David Sceppa (Microsoft Press, scheduled for 7/9/2008.

Sunday, December 30, 2007

JSON vs. XML DataContract Serialization: Download Test Harness

Rick Strahl's DataContractJsonSerializer in .NET 3.5 post of December 29, 2007 describes the .NET Framework 3.5's new DataContractJsonSerializer (DCJS) class from the System.Runtime.Serialization.Json.DataContractJsonSerializer namespace, which contains the serializer and related objects for the lightweight JavaScript Object Notation (JSON) transport (RFC 4627). JSON is one of ADO.NET Data Service's two wire formats, as noted in the "Julie Lerman: Astoria to Become ADO.NET Data Services" topic of Link and Entity Framework Posts for 12/10/2007+. (The Astoria Team intends to add plain old XML (POX) format to v1.0 by RTW.)

Quick Summary: JSON serialization with DCJS requires about 25% to about 40% fewer bytes than the XML DataContractSerializer (DCS) class to represent moderately complex objects, such as Northwind Order and their their associated Order_Detail objects, and takes about 25% longer than the DCS class to serialize and deserialize.

However, Windows Communication Foundation (WCF) serializes JSON streams to an internal XML Infoset wire format that requires about 50% more bytes than DCS to hydrate an object across a process boundary. Adding type="JSONDataType" attributes to each member's element contributes the additional bytes.

The added time to serialize a moderate-sized object collection and the dramatic increase in the size of WCF messages indicates that JSON serialization isn't as lightweight as one would expect from its simple syntax.

You can download the VB 9.0 code for the JsonSerializationWinVB.sln test harness project  here. The project requires Visual Basic 2008 Express or Visual Studio 2008 Standard or higher but doesn't need a database connection. (Mock generic data objects are provided.)

The Test Harness

Rick's sample code uses simple, lightweight objects and I wanted to verify whether the DCJS class actually was lighter in weight and as performant or better than the .NET Fx 3.0's DataContractSerializer (DCS) class with more complex classes containing a variety of data types, including Nullable<T>, and generic collections. So I created the following two classes with the LINQ In-Memory Object Generation (LIMOG) utility that's described in my Serializing Object Graphs Without and With References post of November 21, 2007.

Here are C# versions of the class definitions for the Order and Order_Detail objects used in the tests:

[DataContract(Name = "Order", Namespace = "")] 
public class Order { 
    [DataMember(Name = "OrderID", Order = 1)] 
    public int OrderID { get; set; } 
    [DataMember(Name = "CustomerID", Order = 2)] 
    public string CustomerID { get; set; } 
    [DataMember(Name = "EmployeeID", Order = 3)] 
    public int? EmployeeID { get; set; } 
    [DataMember(Name = "OrderDate", Order = 4)] 
    public DateTime? OrderDate { get; set; } 
    [DataMember(Name = "RequiredDate", Order = 5)] 
    public DateTime? RequiredDate { get; set; } 
    [DataMember(Name = "ShippedDate", Order = 6)] 
    public DateTime? ShippedDate { get; set; } 
    [DataMember(Name = "ShipVia", Order = 7)] 
    public int? ShipVia { get; set; } 
    [DataMember(Name = "Freight", Order = 8)] 
    public decimal? Freight { get; set; } 
    [DataMember(Name = "ShipName", Order = 9)] 
    public string ShipName { get; set; } 
    [DataMember(Name = "ShipAddress", Order = 10)] 
    public string ShipAddress { get; set; } 
    [DataMember(Name = "ShipCity", Order = 11)] 
    public string ShipCity { get; set; } 
    [DataMember(Name = "ShipRegion", Order = 12)] 
    public string ShipRegion { get; set; } 
    [DataMember(Name = "ShipPostalCode", Order = 13)] 
    public string ShipPostalCode { get; set; } 
    [DataMember(Name = "ShipCountry", Order = 14)] 
    public string ShipCountry { get; set; } 
    [DataMember(Name = "Order_Details", Order = 15)] 
    public List<Order_Detail> Order_Details { get; set; } 
} 
[DataContract(Name = "Order_Detail", Namespace = "")]
public class Order_Detail {
    [DataMember(Name = "OrderID", Order = 1)]
    public int OrderID { get; set; }
    [DataMember(Name = "ProductID", Order = 2)]
    public int ProductID { get; set; }
    [DataMember(Name = "UnitPrice", Order = 3)]
    public decimal UnitPrice { get; set; }
    [DataMember(Name = "Quantity", Order = 4)]
    public short Quantity { get; set; }
    [DataMember(Name = "Discount", Order = 5)]
    public float Discount { get; set; }
}

LIMOG adds the Name, Namespace, and Order attribute/value pairs; DCJS processes Name and Order attribute values and ignores Namespace values. I wrote custom SQL commands to generate object initializers for Northwind's last 20 Orders rows with their associated Order Details and Customer rows. A few of the orders are missing Nullable<DateTime> ShippedDate values.

Following are the test harness's four operating modes. Click the image for a full-size capture.

1. JSON (DCJS) Serialization with Parent (Order) Objects Only 

Representative deserialized values appear below the column headers.

2. JSON (DCJS) Serialization with Parent and Child  (Order_Detail) Objects

LINQ queries populate the 1:many Order_Details associations.

DateTime values serialize as "/Date(MillsecondsSince1970-01-01T00:00:00.000 +/- HHMM)/" strings, where HHMM is the offset from GMT in hours and minutes. (RFC 4627 doesn't specify a serialization format for date/time values, which has resulted in free-form encoding by various implementers. Stand-Alone JSON Serialization covers the current .NET implementation for ASP.NET AJAX services created in WCF.)

3. XML (DCS) Serialization with Parent (Order) Objects Only

4. XML (DCS) Serialization with Parent and Child (Order_Detail) Objects

XML Infoset Wire Format for WCF Implementations: Parent (Order) Objects

WCF implementations serialize JSON streams to a "internal" XML Infoset format defined by the Mapping Between JSON and XML white paper. The test harness uses the JsonReaderWriterFactory's CreateJsonReader method to instantiate an XmlDictionaryReader object whose ReadOuterXml method delivers the wire format as a string.

The semi-formatted text of the Infoset follows the report of its length below the deserialized data:

Note: I could find no documentation for the JsonReaderWriterFactory's CreateJsonReader method or creating the required XmlDictionaryReader object; I believe that this project contains the only publicly available example. (Search Google for CreateJsonReader.) Here's an excerpt from the test harness code that's based in part on Rick Strahl's example:

Dim ser As DataContractJsonSerializer = _ 
   New DataContractJsonSerializer(GetType(List(Of Order))) 
Dim ms1 As MemoryStream = New MemoryStream() 
ser.WriteObject(ms1, lstOrders) 
Dim json As String = Encoding.UTF8.GetString(ms1.ToArray()) 
txtBytes.Text = json.Length().ToString() 
ms1.Close() 
Dim ms2 As MemoryStream = New MemoryStream(Encoding.UTF8.GetBytes(json)) 
' Deserialize into generic List 
ser = New DataContractJsonSerializer(GetType(List(Of Order))) 
Dim jsonOrders As List(Of Order) = _ 
    TryCast(ser.ReadObject(ms2), List(Of Order)) 
' Serialize JSON MemoryStream to WCS XML wire format 
Dim xdrJson As XmlDictionaryReader = _ 
    JsonReaderWriterFactory.CreateJsonReader(ms2, _ 
    XmlDictionaryReaderQuotas.Max) 
xdrJson.Read() 
Dim xml As String = xdrJson.ReadOuterXml() 
xdrJson.Close() 
ms2.Close() 

XML Infoset Wire Format for WCF Implementations: Parent and Child (Order_Detail) Objects

As Rick mentioned in a comment to his post:

@Roger - awesome work checking out the perf considerations. I suppose it's to be expected that JSON is slower since the parsing of the JSON objects is necessarily a bit more complex than parsing the more XML so I'm not terribly surprised that it's slower than XML.

OTOH, you're not likely to use this on two way WCF communications, but only for AJAX/REST scenarios coming from a browser most likely and in that scenario there's not much choice since JSON is so much easier to use on the client than XML.

Atom10FeedFormatter<TSyndicationFeed> and Atom10ItemFormatter<TSyndicationItem> generic objects (for classes derived from SyndicationFeed) are likely to be used for two-way WCF communications with ADO.NET data services. Magnus Mårtensson shows you in his Create your own Syndication Feeds with .NET Framework 3.5 post of November 22, 2007 how to use these two objects (and their RSS 2.0 equivalents) to create and serialize SyndicationFeeds. Guy Burstein offers a similar demonstration in his How To: Create a RSS Syndication Service with WCF post of December 3, 2007.

Added: 1/1/2008

Size of Serialized Messages and Serialize/Deserialize Execution Times

Following is a summary table of the data collected for the four operating modes. Message sizes don't include whitespace. Execution times are the average of five tests conducted by reopening the form for each execution (to eliminate the effects of data caching.)

    Parent     Child  
Serializer Time, s. Size, Bytes XML, Bytes Time, s. Size, Bytes XML, Bytes
JDCS 0.416 7,559 14,942 0.467 13,253 31,253
DCS 0.352 9,955 N/A 0.412 21,444 N/A

The preceding data was for a Gateway S-5200D with a dual-core Pentium 2.6 GHz processor running Windows Vista Premium as a virtual client with 1GB RAM assigned under a Window 2005 R2 Virtual Server.

Download the VB 9.0 source code for the JsonSerializationWinVB.sln test harness project  here and give it a try on your development machine.

Updated 12/31/2007: Minor edits and additions

Saturday, December 22, 2007

Two Out of Three Connect Bug Reports for VS 2008 Unacknowledged After Two Months

Joe Wilcox's Microsoft's 12 Gifts of Christmas of December 21, 2007 began with:

12. Connect 3.0 beta. The list begins with a little lump of coal in the Christmas stocking. Microsoft is testing a new Connect Web site. It's time for the Microsoft beta tester revolt, because the new site is butt-ugly. No thanks, Santa!

I used Microsoft Connect extensively during the VS 2005 and 2008 beta programs so I thought I'd give the new design the once-over. I agree with Joe that the home page's design is ugly, but you aren't forced into a search for duplicate reports opening the bug report and I see some usability advantages in the dashboard's right-hand list. Here's a screen capture of what came up for me:

Click image for full-size screen capture.

What struck me (other than the similarity of the orange hues to the OakLeaf site's) when I looked closely at the dashboard was my last three LINQ to SQL bug reports of mid-October that appeared in the Your Watchlist column. I hadn't checked on the bug reports for a few weeks, so I thought I'd see what the VS 2008 Team's response was:

Despite the closeness of the bug reports to the RTM date, I think failing to respond at all to what seem to me to be two significant bugs is inexcusable.

Note: A suggestion for LINQ to SQL, Provide a DataContext.AllowDataExplosions Property for Eager Loading with Multiple 1:N Joins, I made also was in the Your Suggestions region and Dinesh Kulkarney had responded to it.

A cosmetic makeover to Microsoft Connect won't deliver any significant benefits to developers or Microsoft's development teams. Prompt and detailed responses to bug reports are what make developers participate actively in beta programs.

The Connect folks are stomping ants while the elephants are running overhead.

Sunday, November 18, 2007

Link and Entity Framework Posts for 11/19/2007+

Note: This compendium is updated daily or more often, depending on availability of articles. Updated November 20, 21, 23, 24 and 25, 2007.

Keith Farmer Takes on N-Tier Patterns with LINQ to SQL

From the "How Did I Miss This" department? (I missed it because Keith has been a infrequent poster—five posts from March to October 2007.)

Keith's LINQ and 3-Tier Dogma post of November 6, 2007 encourages developers not to be "pattern bigots" (my terminology) when it comes to multi-tier LINQ to SQL implementations. He says, undoubtedly in response to Dinesh Kulkarni's that LINQ to SQL Has No "Out-of-the-Box Multi-Tier Story:

The 3-Tier Model is just a pattern. And, like all patterns, It is meant to serve our needs, not the other way around.

He then goes on to examine the issue of the purity of separation of the data and logic layers:

    • Contractual purity (there is a set of well-known interfaces between the tiers)
    • Binary purity (the types are completely separate in each tier, *and* there is a contract between each)

and explains the advantage of abandoning binary purity in favor of contractual purity. He concludes:

The encapsulation of the data context is the creation of the logical layer.

His follow-on Encapsulation and LINQ to SQL post of November 13, 2007 provides a concrete implementation of encapsulating an IQueryable with a TableView class and an abstract class for wrapping a DataContext with a DataContextWrapper class. The article concludes with a sample implementation of DataContextWrapper.

Added: 11/25/2007

Bill McCarthy Excises LINQ to XML's Duplicate Namespace Declarations

Bill's Cleaning up your XML literal namespaces post of November 24, 2007 includes the code for a short utility program that removes redundant xmlns declarations from elements other than the root when you use the Element1.Add(Element2) method.

Added: 11/24/2007

CoDe Magazine Focuses on Data Access with LINQ and the Entity Framewok

The Data Programmability CoDe Magazine Focus Issue of December 2007 includes the following articles focusing on LINQ:

and these devoted to the Entity Framework:

All authors are from Microsoft's Data Programmability group.

Other articles cover SQL Server Compact Edition (SSCE) 3.5 and the new Sync Framework.

Added: 11/24/2007

LINQ to MPI.NET in Development at Phoster Incorporated

Adam Sobieski, a Phoster Incorporated developer, currently is completing development of System.Collection and System.Collection.Generic implementations for MPI.NET, which is a high-performance message-passing interface for .NET. According to his Update: LINQ to MPI.NET post of November 24, 2007, Adam plans to write a LINQ implementation for the collections.

Here's the University of Indiana's description of MPI.NET:

MPI.NET is a high-performance, easy-to-use implementation of the Message Passing Interface (MPI) for Microsoft's .NET environment. MPI is the de facto standard for writing parallel programs running on a distributed memory system, such as a compute cluster, and is widely implemented. Most MPI implementations provide support for writing MPI programs in C, C++, and Fortran. MPI.NET provides support for all of the .NET languages (especially C#), and includes significant extensions (such as automatic serialization of objects) that make it far easier to build parallel programs that run on clusters.

Adam's interest in LINQ to MIT.NET stems from his work on distributed AI applications using C# 3.0 and .NET 3.5. According to Adam's RETE, CEP, ESP post of the same day:

There are two types of machine reasoning popular today: CEP/ESP and RETE. There’s also combinations (Bruno Berstel, Alexandre Alves). I’m thinking P2P distributed applications with RETE/ESP using LINQ programming practices will allow for rapid-prototyping of some sophisticated AI applications. I’m presently brainstorming some developer libraries in this area (Semantic Grid, Knowledge Grid).

It's not yet clear to me how LINQ to MPI.NET would fit in with the ParallelFX program and PLINQ. PLINQ is directed to multi-core processors. My PLINQ Gathers Momentum post of December 8, 2006 (last updated 7/30/2007) includes many links to early PLINQ articles.

Added: 11/24/2007

Frans Bouma Reaches the Ninth Wave of LINQ to LLBLGen Pro Development

LINQ to LLBLGen Pro is coming along nicely using the LLBLGen Pro API to emulate LINQ to SQL but with the API's database-agnostic SQL intermediate language (IL). Frans is dropping the Skip() and Take() methods in favor of the API's pageNumber and pageSize values for paging, bypassing CROSS APPLY for SelectMany(), and implementing GroupJoin() and DefaultIfEmpty().

Frans' Developing Linq to LLBLGen Pro, part 9 post of November 23, 2007 provides the details of the trade-offs in implementing the preceding Standard Query Operators (SQOs) with the LLBLGen Pro API for multiple RDBMSs.

Note: The "Ninth Wave" refers obliquely to Eugene Burdick's prize-winning 1963 novel, which uses the Celtic ninth wave as a metaphor and Northern California as a backdrop.

Added: 11/23/2007

Bart De Smet Releases RTM Version of LINQ to SQOs

Back in the early days of the LINQ CTPs for VS 2005, Bart De Smet created a custom implemention of the LINQ Standard Query Operators (SQOs). His LINQSQO goes RTM post of November 22, 2007 announces that the RTM version of LINQ to SQOs is available on CodePlex.

The source code contains 148 unit tests that you can run with Visual Studio 2008 Pro or higher. This screen capture shows VS 2008 Pro's Test Results window displaying a few unit test results on the Query class library:

Added: 11/23/2007

Regenerating Original Entities from Entity Framework's ObjectStateManager

Neither the Entity Framework's ObjectContext or LINQ to SQL's DataContext is serializable, so you can't access the ObjectContext.ObjectStateManger's or the DataContext.Table<T>'s original values for an entity.

Danny Simmons' Creating an original value object from the separate values stored in the ObjectStateManager post of November 21, 2007 shows you how to create an an entity with all original property values populated from the partial (changed-value(s) only) data in the ObjectStateManager. Presumably, this entity would be serializable for cross-process transport.

Note: Don't confuse the term "value object" in Danny's post time with "complex objects" (a.k.a. Martin Fowler value objects.)

This post relates to Danny's earlier post about serialization depth (see below.)

Added: 11/23/2007

Alex James Joins the ADO.NET Team as Program Manager for Metadata

Alex James has moved from New Zealand to Seattle to join the ADO.NET Team as Program Manager for Entity Framework (EF) metadata. His initial Introductions blog post appeared on November 9, 2007 but the other ADO.NET EF folks didn't post an announcement, so I missed it. (Thanks to Julie Lerman for the heads-up).

Alex added the following EF-related posts after November 9:

Alex's posting frequency bodes well for his participation in the EF community.

Added: 11/23/2007

Danny Simmons on Serializing Entity Framework Object Graphs

Serializing Entity Framework (EF) object graphs to enable multi-tier data access scenarios incurs the same problems that caused Dinesh Kulkarni to admit that LINQ to SQL Has No "Out-of-the-Box Multi-Tier Story, as discussed in my post of October 18, 2007.

By default, the current EF CTP2 doesn't serialize associated entities. This omission requires that the client to make a method call for each set of instances required and then reconstruct the relationships locally. In this January 27, 2007 Entity Web Service: Returning Category thread Danny recommends creating a facade object to contain associated objects. The thread starter uploaded the alpha 0.1 version of a facade implementation to CodePlex.

Binary serialization for EF entities preserves associated entities but is limited to remoting or services on intranets because the payload won't pass through Internet firewalls. Binary serialization creates a deep clone of associated objects; that is, references to shared objects turn into individual copies of these objects. This results in what's called a "data explosion" and very large service/remoting payloads.

Danny's Question: Deep serialization of an object graph--how deep should it go? post of November 20, 2007 discusses three potential serialization options for future CTPs or versions:

  1. Return the entire object graph with 1:many and many:1 associations intact. Such graphs generate extremely large payloads and won't serialize with the default DataContractSerializer of Window Communication Foundation (WCF) because of cyclic references (also called cycles.)
  2. Remove the 1:many associations to prevent conflicts when multiple operations return graphs that include duplicate objects. LINQ to SQL implements this option by not serializing any 1:many associations. This is required to prevent cyclic references.
  3. Specify subgraphs on a method-by-method basis.

To serialize complete graphs with 1:many and many:1 (bidirectional) associations intact requires a rather complex workaround for the Windows Communication Framework's default DataContractSerializer or use of the NetDataContractSerializer.

Note that neither ObjectContext nor DataContext objects are serializable, which limits their identity managers and change trackers to in-process use.

Unless the ADO.NET team chooses one of the three options for EF v1, EF won't have an "out-of-the-box multi-tier story" either.

I'm working on a post with some examples and an analysis of a choice between options 2 and 3. Click here for a preview of the Serializing Object Graphs Without and With References post of November 21, 2007 (updated 11/23 and 11/25/2007) with downloadable files containing examples of serialized XML Infosets and schemas generated by the DataContractSerializer (DCS) and NetDataContractSerializer NDCS. Test with in-memory List<T> collections show that the NDCS serializes and deserializes bidirectional associations correctly.

Added: 11/20/2007 Updated: 11/23/2007 and 11/25/2007

Zlatko Michailov: Compiling LINQ to Entities Queries

Zlatko's previous post, Behavior of Variables in LINQ to Entities Queries of November 16, 2007, recommended compiling queries to remove LINQ to Entities' uncertain treatment of variables assigned literal values as constants or parameters.

Today's brief post, LINQ to Entities: Compiled Queries, explains the compilation process, which, like compiling LINQ to SQL queries, improves performance. Parameters are explicit for compiled queries.

Bill Horst of the VB Team: Converting SQL to LINQ Series

The VB Team posted the first of a series of articles, Converting SQL to LINQ, Part 1: The Basics (Bill Horst), on 11/19/2007. This episode covers basic LINQ query syntax. Future articles will cover LINQ equivalents to these T-SQL keywords:

  • FROM and SELECT
  • DISTINCT, WHERE, ORDER BY, Operators
  • Functions (Scalar and Aggregate)
  • GROUP BY and HAVING
  • Joins
  • UNION, TOP and Subqueries

InterLINQ Provider Alpha 0.2 Serializes Expression Trees

Pascal Schaefer and Manuel Bauer of the Swiss Software Solution Center have posted the Alpha 0.2 release of the InterLINQ library, including sample implementations for NHibernate, LINQ to SQL and LINQ to Objects, and a help file.

InterLINQ serializes the expression tree of a LINQ query so you can transport it across machine boundaries and execute it with a LINQ implementation on a server. It's up to you how to return the query result set to the client. LINQ to SQL lets you mark its partial classes as unidirectionally serializable, so classes with m:1 EntityRefs and 1:n EntitySets lose their EntityRefs because of the circular reference.

Tip: Right-click the InterLinq.chm file, choose properties, and click the Unblock button to read the help pages.

Danny Simmons: Entity Framework Beta 3 Due in a Few Weeks

From an answer to a question by Henrik Dahl in the ADO.NET (Pre-release) forum:

We're working hard to wrap up the last round of testing and bug fixes on the EF and the EF designer.  The plan is to release beta 3 of the EF/CTP 2 of the designer in a few weeks (think "early December").

Thanks to Julie Lerman for the heads-up.

Paul Stovell Explains SyncLINQ for Real and Derived Client State

In his Why SyncLINQ should matter to you post of November 15, 2007 and follow up Three categories of SyncLINQ queries article of November 16, Paul explains how derived state differs from real state in desktop client apps. He als demonstrates how SyncLINQ keeps derived state synchronized with real state as the data underlying real state changes.

Paul's in the process of coding the first SyncLINQ iteration. He writes:

In terms of right now, I have just implemented the first set of aggregate extensions, and I have a basic dependency system working. Over the coming week I’ll be working to implement an operator, and refactor much of the dependency system to support the overloads above.

His Introducing SyncLINQ post of October 16, 2007 includes a seven-minute video clip of SyncLINQ in action.

Note: There's still no library to download.

Mary Jo Foley: VS 2008 Rumored to be Available Monday 11/19/2007

Mary Jo writes "Sources say Microsoft will announce availability on Monday, November 19" in her "Visual Studio 2008 to go gold as soon as Monday" column of November 18, 2007.

eWeek's Daryl K. Taft quotes the MSDN Subscriptions WebLog post of November 16, 2007 in his Visual Studio 2008 Is Imminent post of November 17, 2007 as stating "Visual Studio 2008 is anticipated out early next week, with availability for subscribers." However, on November 18, 2007, the posts first sentence read "Visual Studio 2008 is anticipated out very soon, with availability for Subscribers." I assume the blog author edited the post without revision marks.

Be sure to review Dinesh Kulkarni's two LINQ Project General Forum posts about Beta 2 to RTM changes fo LINQ to SQL:

Jim Wooley suggests:

  • Open the DBML file as XML and change the UTF encoding from 16 to 8. Otherwise the compiler will complain about the DBML file's format.

Update 11/19/2007 1530 PST: LINQ to SQL Beta 2 to RTM Breaking Changes has been published as a downloadable .docx file. Charlie Calvert's Visual Studio 2008 Available for Download post has links to independently published files, such as the C# LINQ and language samples for Visual Studio 2008, which were updated 11/9/2007. The Visual Studio 2008 Samples page has a current list of samples for VB and C#.

Hopefully, the LINQ to Objects, LINQ to XML and LINQ to DataSets teams will post Beta 2 to RTM changes, if any, soon.

Update 11/19/2007 0700 PST: The rumors were correct. Microsoft made the download available but the MSDN servers were throwing  "Server Error in '/' Application. The file '/home.aspx' has not been pre-compiled, and cannot be requested." errors from the entry page for the download: https://msdn.one.microsoft.com/home.aspx?ApplicationID ..., which is not a good sign. Subsequently, the error messages changed to the more common "Server too busy."

Update 11/19/2007 0900 PST: Servers finally became operable.

Update 11/19/2007 1200 PST: Scott Guthrie has posted Visual Studio 2008 and .NET 3.5 Released with a summary of new features and links to related resources. Guy Burstein notes that you can download the Visual Studio 2008 and .NET Framework 3.5 Training Kit, too (120MB.)

Dinesh Kulkarni Writes a Common Base Class for LINQ to SQL Queries

If you want to "encapsulate a pattern and common behavior" across multiple business entities generated by SqlMetal.exe or the O/R Designer, Dinesh's "LINQ to SQL Tips 2: how to use common base class for all entities post of November 9, 2007 (released November 18, 2007) shows you how.

Danny Simmons: Handling Conditional Relationships in the Entity Framework

If your DBA has set up Relationships from Hell as described in Danny's An Interesting Relationship Mapping Scenario post of November 17, 2007 there might be a solution that works with Entity Framework v1, but it's more likely that you'll need to model a containment relationship with v2 (or later).

The many:one relationships Danny describes are defined by foreign key and type column values. The foreign key value points to the primary key of a table that's selected from a group of tables by a value in a type column. Only one many:one relationship occurs at any instance.

Danny describes a containment relationship thusly:

The basic idea of this construct is that "child" entities may be related to one or more "parent" entities but only one parent at a time.

The relationship Danny describes doesn't fit with my understanding of a containment relationship, which is more in tune with that described in the Object Containment topic of class notes for a Database Systems and Structures class at Simon Fraser University.