Monday, October 15, 2007

LINQ and Entity Framework Posts for 10/15+

Mike Taulty Customizes a Wrapper for System.Data.Entity.Design Classes

Mike's LINQ to Entities - Customising the edmgen.exe Output post of 10/21/2007 shows you how to write a configuration file that customizes the EdmGen.exe process with added attributes. Mike says you can "add extra interfaces and members to the entity classes," but his sample doesn't demonstrate this.

Added 10/22/2007

Julie Lerman on Improving Entity Framework Performance with DataReaders

Julie's EF EntityClient for performance post of 10/19/2007 qualifies her earlier Choosing LINQ to Entities vs Entity SQL vs. EntityClient post by noting that "one of the most important reasons about being able to return datareaders, in case it isn't obvious: Performance. But note that this is for reading only."

Added 10/22/2007

Scott Guthrie's Current LINQ to SQL Posts in PDF Format

Kadir Pakel has assembled a compilation of ScottGu's first nine LINQ to SQL blog posts into a 118-page, fully formatted PDF document.

In an October 9, 2007 reply to a reader's comment, Scott says:

I'm hoping to do the next segment this upcoming weekend.  They tend to take several hours to write, and I've been really busy the last few weeks, which is why the delay.  Hopefully I'll find a few hours to produce more soon!

As I recall, one of the topics on tap relates to multi-tier deployment of LINQ to SQL with WCF. I hope Scott reads Dinesh's and my posts on the topic before writing much code.

Added 10/19/2007

It's True: LINQ to SQL Has No "Out-of-the-Box Multi-Tier Story!"

This is my detailed description of an attempt to work around item #2 of Dinesh Kulkarni's LINQ to SQL: What is NOT in RTM (V1) post. The project adds two levels of EntityRefs to a databound test harness that implements Mike Taulty's not-so-mini, unbound ClientSideContext in a WCF client.

The article was last updated 10/19/2007 at 1300 PST.

Added 10/19/2007

Julie Lehrman: Choosing LINQ to Entities vs Entity SQL vs. EntityClient

Julie says the title should have been "Choosing LINQ to Entities vs. Entity SQL+Object Services vs. Entity SQL+EntityClient" as she describes which approach is the most practical for specific data access projects.

LINQ Cookbook, Recipe 9: Dynamic Sort Order from the VB Team

The VB Team claims:

This recipe shows how to create a custom function to provide values to be used when sorting a LINQ query.

Added 10/19/2007

Beth Massi on Getting Started with LINQ to XML

Beth suggests watching an overview to LINQ to XML video and then digging into what she "would have shown next." 

Dinesh Kulkarni: LINQ to SQL: What is NOT in RTM (V1)

Dinesh Kulkarni admits in his October 15, 2007 LINQ to SQL: What is NOT in RTM (V1) post that LINQ to SQL v1 will be missing (at least) the following features:

  1. Support for other databases with or without a public provider model.
  2. Out-of-the-box multi-tier story.
  3. Handling schema changes.
  4. Support for specific mappings (value types and m:n relationships with no relation table.)
  5. Identity between designer, SqlMetal and run-time (external mapping file and SSC support in designer)
  6. LINQ to SQL in compact framework.

[I've abbreviated Dinesh's topics and the emphasis is mine.]

See my LINQ to SQL Has No "Out-of-the-Box Multi-Tier Story!" for more details.

Added 10/19/2007

LINQ to SQL's GetOriginalEntityState() Method Has a Serious Bug

My GetOriginalEntityState() Loses EntitySet/EntityRef Data post of October 15, 2007 describes a problem with missing EntitySet and EntityRef property values when invoking the Table<TEntity>.GetOriginalEntityState(modifiedMember) method to retrieve the original values of an entity member. The Connect bug report is Feedback 304732: GetOriginalEntityState Doesn't Include EntitySet or Entity Ref Data for Related Entities of 10/15/2007. Matt Warren says it isn't a bug but at least he doesn't claim it's a feature.

Paul Stovell Introduces SyncLINQ for Databinding LINQ Queries

Austrailian .NET Developer and MVP Paul Stovell will release this week an early alpha version of his SyncLINQ extensions, which return collections that implement the System.ComponentModel namespace's INotifyCollectionChanged interface. This interface is an analog of the INotifyPropertyChanged interface that LINQ to SQL's DataContext class implements.

A quick description of SyncLINQ is a simple implementation of QueryNotifications for LINQ collections.

The first alpha will support:

  • Where()
  • Select(), including projections into anonymous types
  • OrderBy(), ThenBy() both ascending and descending
  • Union()

While waiting for the first bits to drop, you can watch Paul's seven-minute video clip that demonstrates SyncLINQ features from his Introducing SyncLINQ post of October 16, 2007 (Australian time).

Paul promises that SyncLINQ ultimately will:

  • Work against any LINQ provider
  • Support all LINQ extension methods
  • Provide two custom extension methods
    • Asynchronous() to run LINQ queries on a worker thread
    • ToSyncLinqPolling(time) to poll data sources
  • Work with Windows forms and WPF

Julie Lerman Checks Out Unit Testing for LINQ to SQL and Entity Framework

Julie's Unit testing LINQ to SQL and Entity Framework post of October 14, 2007 describes her exploratory work with the unit testing feature that the Visual Studio team finally added to the VS 2008 Professional Edition (in addition to its previous presence in the Team Client Edition).

K. Scott Allen's Unit Testing with Visual Studio 2008 post has a brief history of unit testing in Visual Studio, its early problems, and its current status (plus links to a couple of good unit-testing resources.)

Dinesh Kulkarni Objects to CRUD Methods in Entity Classes

His October 14, 2007 No CRUD on entity please (aka anti-pattern of DB access methods on data/biz object) post explains why CRUD (Create, Read, Updated, Delete) methods don't belong in entity classes without using the term persistence ignorance.

LINQ to SQL's DataContext object is responsible for all CRUD operations and supports Martin Fowler's Unit of Work pattern with an implicit transaction and concurrency conflict management.

Assigning all CRUD operations to the DataContext object is what makes Mike Taulty's ClientSideContext object usable as a "mini connectionless DataContext" when the GetOriginalEntityState() method's bigtime bug gets fixed.

Omar Al Zabir Emulates a Google Start Page with Linq to SQL, Linq to XML, et al.

Omar has created an Ajax Start Page, which he says is just like iGoogle, using LINQ to SQL, LINQ to XML, Workflow Foundation and ASP.NET AJAX 3.5. This Code Project document describes it and offers a link to downloadable source code.

You can read a full description and instructions for checking out the code in his Ajax Start Page using VS 2008 and .NET 3.5 post of October 14, 2007.


Matt Warren said...

Roger, its not possible for GetOriginalEntityState to return copies of entities with EntityRef's and EntitySet's set. These associations are normally bi-directional, so only one entity instance can ever refer to another without duplicating the entire graph. The purpose of GetOriginalEntityState is to give back a copy of the entity with only the data fields set.