skip to main | skip to sidebar
Showing posts with label Task Parallel Library. Show all posts
Showing posts with label Task Parallel Library. Show all posts

Monday, December 24, 2007

LINQ and Entity Framework Posts for 12/24/2007+

Note: Happy New Year! There probably won't be many updates to this linkblog post.

JSON vs. XML DataContract Serialization: Downloadable Test Harness

This VB 9.0 test harness compares the message size and performance of moderately complex objects serialized and deserialized by the NET Framework 3.5's new DataContractJsonSerializer (DCJS) class and the .NET Fx 3.0's XML-based DataContractSerializer (DCS) class.

Here's a screen capture of the test harness's second mode, which displays the formattted JSON string for Northwind Order and Order_Detail objects:

Click the image for a full-size screen capture.

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 code is based on Rick Strahl's original version described below.

Rick Strahl Dissects .NET Framework 3.5's JSON Serializer

Rick's DataContractJsonSerializer in .NET 3.5 post of December 29, 2007 delves into the System.Runtime.Serialization.Json.DataContractJsonSerializer namespace, which contains the serializer and related objects for the lightweight JavaScript Object Notation (JSON) transport (RFC 4627). Rick observes that this serializer produces "Plain Old JSON" (POJ?) text without the proprietary __type="TypeName" attribute that ASP.NET 2.0 AJAX Extensions introduced.

To run Rick's code, you must add references to System.Runtime.Serialization (v3.0 for WCF) and System.Service.Model.Web (v3.5 for JSON), and the following directives:

using System.Runtime.Serialization.Json;
using System.Collections.Generic;
using System.IO;
using System.Text;

Add a using System.Runtime.Serialization; directive if you want to decorate classes with [DataContract] instead of [Serializable] attributes and add the [DataMember] attribute to public fields or properties you want to serialize.

Added: 12/30/2007

Paul Yuknewicz: ASP.NET LinqDataSource Guided Tour

The VB Team's LINQ for the Web Using VB (By Paul Yuknewicz) post provides an illustrated guided tour of the LinqDataSource component and LINQ to SQL behind a simple ASP.NET 3.5 Web site. The post is similar to Scott Guthrie's LINQ to SQL: Part 5 - Binding UI using the ASP.NET LinqDataSource Control post of July 16, 2007 except that VB substitutes for C#.

Added: 12/28/2007

Paul Vick: Visual Basic 9.0 Spec (Almost) Cooked

Paul Vick's (Almost) final VB 9.0 language specification posted article of December 27, 2007 (almost) says it all. You can download the latest edition (sans final copy edits) here. According to Paul, the spec covers the following new VB 9.0 features:

  • Friend assemblies (InternalsVisibleTo)
  • Relaxed delegates
  • Local type inferencing
  • Anonymous types
  • Extension methods
  • Nullable types
  • Ternary operator
  • Query expressions
  • Object initializers
  • Expression trees
  • Lambda expressions
  • Generic type inferencing
  • Partial methods
  • XML Members
  • XML Literals
  • XML Namespaces

Added: 12/27/2007

.NET Rocks: Joe Duffy on the Parallel Extensions and PLINQ

Carl and Richard interview Joe Duffy, the PM behind the Task Parallel Library (TPL), Parallel Extensions for .NET (PFX), and Parallel LINQ (PLINQ), about parallel (concurrent) programming and multi-core processors in Joe Duffy on the Task Parallel Library of December 24, 2007.  See the "Parallel Extensions" topics in LINQ and Entity Framework Posts for 11/26/2007+ and my PLINQ Gathers Momentum post of December 8, 2006 for more background.

Note: The PFX Team now has a Parallel Programming with .NET blog that has several posts on the use of PLINQ. Links to this blog will be added to future posts.

Added: 12/27/2007

Mike Taulty Discovers that WebDataGen.exe Doesn't Recognize LINQ to SQL Associations

Mike's ADO.NET Data Services - LINQ to SQL and Associations post of December 24, 2007 points out that when you run WebDataGen.exe against the URL of a .NET Data Source based on LINQ to SQL associations are ignored. The metadata that exposes associations as a Property of the String data type. Using an Entity Framework data source designates associations with a typed NavigationProperty and a corresponding Association element group.

This obviously prevents writing LINQ to REST queries that traverse associations. Defining LINQ to SQL entities with hand-written classes, as outlined in Andy Conrad's Linq to REST post of December 10, 2007, enables associations. You can then substitute LINQ queries, such as

var query2 = from c in context.CreateQuery<Categories>("Categories")
             where c.CategoryID == 1
             select new { c.CategoryID, c.CategoryName, c.Products };

for WebDataQueries like

WebDataQuery<Categories> query =
    context.CreateQuery<Categories>("/Categories(1)?$expand=Products");

However, I've found that any attempt to filter collections with Where criteria based on child member values, such as

var query = from c in context.CreateQuery<Customer>("Customers")
            where c.Country == "USA"
            && c.Orders.Any(o => o.Freight > 50)
            orderby c.CompanyName
            select c;

fail with a 400 - Bad Request error because the query string isn't composed properly. (Commenting the Freight amount test enables the query to execute.)

It's not clear to me how restricted LINQ to REST query syntax will be at RTM. It's likely that many Astoria users will load large chunks of data into memory-resident IEnumerable() sequences (probably generic Lists) and query them with client side LINQ to Objects expressions.

Mike Taulty Suggests Cure for Error 7005: 'Namespace' Attribute Is Invalid

The solution in Mike's ADO.NET Data Services and CLR Namespaces post of December 24, 2007 is to "put the types that you're exposing (i.e. the T that you have fed into WebDataService<T>) into a CLR namespace."

So far, I haven't encountered that exception.

A Christmas Present from Milan Negovan: A LINQ Cheat Sheet

You can read and download the two-page Cheat Sheet for Standard Query Operators (method call syntax) at Milan's ASP.NET Resources site.

Mike Flasko Proposes Eliminating Parent Key Duplication with Deep Addressing

Mike Flasko's Design Notes: URI Containment in Astoria post of December 21, 2007 (missing from previous linkblog post) observers that parent keys are duplicated in following case b:

a) entities are always addressable through top-level entitysets, e.g. /OrderLines(1,2)

b) deep addressing through container has redundant information, e.g. /Orders(1)/OrderLines(1,2)  (the container id, “1”, is repeated)

The plan is to annotate the CSDL and CLR object model to indicate a parent/child relationship to eliminate the repetition.

Tuesday, October 09, 2007

LINQ and Entity Framework Posts for 10/5/2007+

Jim Wooley Demos WCF 3.5's SyndicationFeed Feature for RSS/ATOM Feeds

Jim's October 12, 2007 Adding RSS posts to ThinqLinq using System.ServiceModel.Syndication.SyndicationFeed post demonstrates the progression of a VB 9.0 LINQ to SQL application that uses LINQ to XML to persist objects from RSS feeds to a database:

  1. Query the feed document and use a For Each loop and invoke the DataContext.Add() method to insert each object into the DataContext. Finally apply the DataContext.Submit() method to persist the collection.
  2. Early-bind element names and execute a LINQ query to generate an IEnumerable(Of PostItem) collection of projections created with object initializers. This eliminates the need for the For Each loop.
  3. Substitute SyndicationFeed.Load(Uri) for XDocument.Load("URL") to obtain a strongly typed object model that handles RSS and ATOM formats interchangeably.

System.ServiceModel.SyndicationFeed is a new Windows Communication Foundation feature in .NET 3.5's System.ServiceModel.Web namespace.

Added: October 12, 2007, 0930 PST

Erick Thompson Finally Describes LINQ to DataSet's LinqDataView Object

Erick provided a brief review of databinding with LINQ to DataSet in his LINQ to DataSet – Data Binding post of August 24, 2007 and promised to "be digging into more detail soon." Almost a month and a half later, he posted LINQ to DataSet Data Binding – Introducing LinqDataView on October 5, 2007, but I missed it. Thanks to the ADO.NET team who added a LINQ to DataSet DataBinding post today with a pointer to Erick's earlier post, which probably wasn't what they intended, I caught the October 5 post.

LinqDataView is an internal object from the System.Data.DataSetExtensions namespace that inherits DataView and implements LinqDataView, IBindingListView, IList, ICollection, and IEnumerable. Implementing the IBindingListView interface enables advanced (multi-column) sorting and filtering, as mentioned in my September 7, 2007 Support Sorting and Filtering for List<T> Collections post. You create a LinqDataView instance when you invoke the AsDataView() method on a LINQ to DataSet query.

Erick recommends using the LinqDataView for databinding UI controls and fast indexed lookup operations.

Erick says his "next post will talk about restriction joins and leveraging the index for fast lookups." Let's hope it comes a bit quicker than this one.

Earlier LINQ to DataSet references from LINQ and Entity Framework Posts for 9/7/2008+:

  • Andrew's Science Project post of September 7, 2007 includes the source code for a LINQ to DataSet extension method that removes the CopyToDataTable<T> method's restriction of the generic T type parameter to DataRow. The extension method enables loading instances of anonymous types into DataRows.
  • Daniel Moth has a July 27, 2007 LINQ to DataSet item with details of the classes in the System.Data.DataSetExtensions namespace.
  • Here are links to Erick Thompson's three introductory LINQ to DataSet posts from February 2007: Part 1, Part 2 and Part 3.

Added: October 12, 2007, 0930 PST

Frans Bouma Moves from Days to Parts and Admits Matt Warren Was Right About Sets

In Developing Linq to LLBLGen Pro, part 6 of October 12, Frans recounts at length a misstep when attempting to "outsmart the algorithm of Topological Sorting in a Directed Acyclic Graph (DAG)."

Object graphs are DAGs and Frans mentions that "cycles in relational models which are reflected in entity models is a Bad Thing and typically have to be redesigned." I mention the issue with cycles in serializing entities generated from LINQ to SQL that have both m:1 and 1:n associations in my LINQ to SQL and Entity Framework XML Serialization Issues with WCF - Part 1 of October 9, 2007.

Update October 15, 2007: Frans clarifies in a comment that he's referring specifically to cycles in relational models rather than cycles in related object graphs. The latter topic is one of the subjects of my XML serialization issues posts.

Frans then equates his earlier DAT and Topological Sorting foible with the requirements for handling a multiplying number of special cases in his previous (day 5) post, concludes that Matt Warren's following recommendation in a comment to use sets was right.

Dinesh Kulkarni Compares Capabilities of SqlMetal, the O/R Designer and Code

Dinesh is on a blogpost roll with a second post in two days. His LINQ to SQL: features not in the designer / SqlMetal post is dated October 9, 2007 but didn't show up on my reader until this morning. The article covers design features that:

  1. You can implement with SqlMetal.exe but not the graphical O/R Designer
  2. You can implement with the graphical O/R Designer but not SqlMetal.exe
  3. You can't implement with SqlMetal.exe nor the O/R Designer and require writing code

Dinesh mentions two items under category 3:

    1. POCO (Plain Old CLR Objects) - this is worth another blog post
    2. User overrides (e.g. sprocs) for relationship loading

My Save Server Round Trips by Preloading LINQ to SQL EntityRefs post of October 1, 2007 describes how to minimize round-trips and limit the size of associated EntitySets.

Added: October 11, 2007, 0930 PST

Joe Cheng Solves the Wide Finder Problem with LINQ and PLINQ

Tim Bray's Wide Finder Project originated as an exercise to improve the performance of a small Ruby program that reads Apache logfiles, applies a regular expression, counts, sorts, and finally prints the 10 most popular blog posts. The challenge is to take advantage of the CPU's multiple cores by using parallel processing to improve performance.

Joe Cheng, a developer on the Windows Live Writer team, posted on October 2, 2007 Wide Finder with LINQ, which contains a compact LINQ query with a few lines of C# code that beats the performance of the Ruby by a couple of seconds when reading a million-line logfile.

A pure C# version beat the LINQ query by a couple of seconds, but required 85 lines of code. As Joe notes, the LINQ version has the potential to use Parallel LINQ (PLINQ) from the forthcoming Parallel FX Library to improve performance.

See the "Luke Hoban Gets the Most Complex LINQ Query Award (and PLINQ Compatibility)" topic of my LINQ and Entity Framework Posts for 10/2/2007+ post, which describes the Parallel FX program and task parallel library:

The obvious advantage of moving from "conventional" C# 3.0 constructs to a single LINQ query is Parallel LINQ (PLINQ, which is part of the Parallel FX or PFX program) compatibility for simplified parallel processing on multi-core machines. There's a substantial Microsoft team at work on PLINQ and the October 2007 issue of MSDN Magazine carries a "Running Queries On Multi-Core Processors" story about PLINQ by Joe Duffy and Ed Essey.

Joe plans to release a PFX CTP in 2007. Watch his blog for details.

Daan Leijen and Judd Hall describe the more complex forthcoming Task Parallel Library (TPL) in an "Optimize Managed Code For Multi-Core Machines" article in the same issue. The C# 3.0 ray-tracer version upgraded with TPL will be an sample application in the PFX CTP.

Joe promises to publish performance data when Microsoft releases the Parallel FX Library.

Note: Don Box published in Wide Finder in C# - the Naive implementation of October 9, 2007 a more complex LINQ query that reads a stream from the logfile but appears to be slower than Joe Cheng's version (which Don cites in a ednote update.)

Credit: I use Windows Live Writer to author this blog. My review of the first beta version is Windows Live Writer (Beta) Blogger Test-Drive of August 14, 2006.

Added October 11, 2007, 0800 PST: I found this jewel thanks to Tim Bray's WF IX: More, More, More post of October 10, 2007)

Beth Massi Conducts Channel9 Sync Services Interview with Milind Lele

This blog also covers SQL Server CE and Microsoft Synchronization Services (a.k.a. Occasionally Connected Systems or OCS) topics, which don't see as much action as LINQ and the Entity Framework. Milind is a program manager on the VB Team, so you get to see some VB code instead of Sync Guru Rafik Robeal's C#-only samples.

You can catch the interview here.

Backstory: Mary Jo Foley's Microsoft ‘Arrowhead’ to up support for ‘occasionally connected’ apps post of October 10, 2007 makes this Sync Services/OCS interview more interesting. Apparently, Microsoft wouldn't respond to Mary Jo's "How does Arrowhead dovetail with Microsoft’s current offline synchronization platform, ADO.Net Sync Services?" query.

Sync Services gained considerable momentum at Microsoft after Google launched Google Gears. See my Google Gears Piques New Interest in Data Synchronization post of June 7, 2007.

Updated: October 11, 2007, 1300 PST

Julie Lerman Describes How to Customize Your Astoria Data Source

Her Custom Operations and hiding entities in Astoria post of October 10, 2007 shows how to "customize your service by providing explicit query operations and also blocking specific query operations." She also notes that you can build read-only views into the service, but you'll have to "wait wait until we have bits that are not just prototype" to learn how to enable stored procedures.

Added: October 10, 2007, 1230 PST

Mike Taulty Implements an Unbound DataContext in a WCF Client

My updated version of the LINQ to SQL and Entity Framework XML Serialization Issues with WCF - Part 1 post mentions Mike Tulty's displeasure (which I share) with the tedium of writing code to clone and save original values to implement value-based concurrency conflict management. So Mike described in his LINQ to SQL and WCF - Sharing types, subverting the DataContext on the client side post of October 9, 2007 how to implement in a Windows Communication Foundation (WCF) client a DataContext class that's not bound to a database. The starting point is client and service described in his initial Disconnected LINQ to SQL post of September 14, 2007.

The unbound DataContext provides Attach(), AttachAll(), Add(), AddAll(), Remove()and RemoveAll() methods for Table<TEntity> implementations of the ITable interface and stores the original and changed entity values. You apply changes to the attached entities directly. The Table<TEntity>.GetModifiedMembers() method contains references to added, removed, and modified members.

Invoking Mike's GetInserted(), GetModified() and GetDeleted() methods supply modified argument values to InsertEntity(modified, original) and UpdateEntity(original, modified) service methods. The Table<TEntity>.GetOriginalEntityState() method provides original argument values to the preceding two service methods, plus the DeleteEntity(original, modified) method. (DeleteEntity() requires both arguments because you must attach the entity before you remove it.)

Mike includes a simple client console app to test his methodology, which he says "is really a bit subversive and possibly a bit evil."

What's interesting about this approach is its similarity to Matt Warren's promised "mini connectionless DataContext" that I discussed in my Changes Coming to LINQ to SQL post of May 15, 2007. This article resulted in a long LINQ: Next CTP thread in which Matt Warren reneged with these two posts:

No, this feature will not be in the first release of LINQ to SQL. ...

It is only missing because of lack of time. When I mentioned it, I was talking about our forward thinking and a sample I'm trying to put together.

WCF's proxy generation tool creates the client-side classes that Mike includes in his DataTypes class library generated by executing sqlmetal.exe /server:. /database:northwind /serialization:Unidirectional /pluralize /code:northwind.cs, with these exceptions:

  • The proxy classes don't implement the INotifyPropertyChanging interface.
  • The class library doesn't add the ExtensionData property to the entities.

Neither of the above problems should be fatal, so I'll give Mike's approach a test with the C# version of the test harness described in yesterday's LINQ to SQL and Entity Framework XML Serialization Issues with WCF - Part 1 post and report my results.

Note: Mike uses the terms Shared Contract and Shared Types differently than the WCF team. Sowmy Srinivasan describes the difference between the two terms in his All About KnownTypes post of June 06, 2006 by how they're serialized on the wire. Aaron Skonnard discusses the history of WCF SharedContract and SharedType modes in his WCF's NetDataContractSerializer post of April 21, 2006. Services that use the default DataContractSerializer implement the SharedContract mode.

Added: October 10, 2007, 1100 PST

Update October 11, 2007: Mike's DurableServices in WCF V3.5 :-( post today indicates to me that he's working on another approach or a supplement to maintaining context with WCF features akin to Durable Services.

Update October 14, 2007: Corrected service method names and clarified client-side operations in conjunction with the

Dinesh Kulkarni Links to Breaking Changes from LINQ to SQL Beta 2 to RTM

Apparently Dinesh doesn't believe that folks are checking posts in the LINQ Project General forum, so he added in his LINQ to SQL breaking changes from beta2 to RTM (compiled from my LINQ forum posts) post of October 9, 2007 links to his three previous posts on the subject:

I can only assume that these two important changes not included in the preceding list won't beak Beta 2 code:

because Dinesh didn't mention them in his post or the liked threads.

Added: October 10, 2007, 1200 PST

Eric White Summarizes Changes to LINQ to XML from Beta1 to Beta2 and RTM

Not to be outdone by the LINQ to SQL team, Eric White's October 9, 2007 Upcoming changes in LINQ to XML post lists four changes between Beta 1 and Beta 2 and three more coming up in RTM.

Added: October 10, 2007, 1200 PST

Beth Massi Links to Scott Hanselman's Audio Podcast about LINQ to XML

Scott Hanselman recorded on August 31, 2007 a <LINQ to XML/> Hanselminutes podcast that's hosted by Carl Franklin.

Beth announced that she'll present Conquering XML with LINQ in Visual Basic 9.0 at the QCon Conference in San Francisco (see QCon 2007 and Erik Meijer Coming to San Francisco November 7 - 9 of August 2, 2007.)

There's a list of 14 LINQ to XML resources and she also promises future "How Do I?" LINQ to XML videos at the bottom of her Scott Hanselman on VB9's New "XML Hotness" post.

Added: October 10, 2007, 1230 PST

LINQ to SQL and Entity Framework XML Serialization Issues with WCF - Part 1

This post introduces the issues I encountered when attempting to create a sample application that illustrates interactions between a real-world, data-bound Windows client, Windows Communication Foundation (WCF), and LINQ to SQL data access layer (DAL).

The post deals with the full lack of object-graph schema fidelity to the original entity's properties. You lose Attached Associated Objects Bugs for m:1 associations if your object has EntitySets for 1:n associations that share a common property.

There's also a graphic example of the "Attached Associated Objects Bug" that duplicates associated entities when attaching a Table<TEntity> object that has EntitySet properties to a DataContext.

Added: October 9, 2007, 1700 PST

Matt Warren Tackles the Four OrderBy Flavors in Part VIII of His Building an IQueryable Provider Saga

LINQ: Building an IQueryable Provider - Part VIII begins with Matt's observation:

Fortunately, there is only one way to do ordering, and that's using the LINQ ordering specific query operators. The bad news is that there are four different operators.

Matt then runs into (and around) corners resulting from the immutability of expression trees and devises an amazing OrderByRewriter class that he describes as "a whole lot of something!" to handle what appears to be this simple LINQ query:

var query = from c in db.Customers
orderby c.City
where c.Country == "UK"
select new { c.City, c.ContactName };

As usual, the source code is available to download.

Added: October 9, 2007, 1700 PST

"Leverage LINQ in ASP.NET 3.5 Projects" Available for Download from WROX

My Leverage LINQ in ASP.NET 3.5 Projects article is one of four inaugural Wrox Blox downloadable "informational pieces" that "help get you up-to-speed and keep you up-to-date" plus "build the knowledge you need quickly on a wide variety of topics."

For 3ドル.99, you can download the 38-page tutorial and it's accompanying C# and VB source code for a complete LINQ to SQL data access layer (DAL). The DAL binds to a LinqDataSource or ObjectDataSource control and an updatable GridView control on ASP.NET 3.5 pages. (The source code requires Visual Studio 2008 Beta 2 or later and the Northwind sample database installed on an SQL Server 2005 Express instance.)

You can add a new "BOGUS" Customer entity with code, edit its properties in the grid, and delete the entity without affecting your original Northwind Customers table's contents.

Click image for full-size screen capture.

The source code for the LinqDataSource and ObjectDataSource test harness is available here.

Added: October 9, 2007

Update October 9, 2007: Wrox Blox editor Jim Minatel offers more details on the new format in Wrox Blox launches with Silverlight, Adobe AIR, IPhone and LINQ and announces Wrox's ASP3wiki, the second Wrox electronic product to launch this week.

Catch 10 LINQ-Related Sessions at Tech*Ed Developer 2007

Tech*Ed Developers 2007 to Include 10 LINQ-Related Presentations includes abstracts and presenter names of the 10 sessions in Tech*Ed 2007 Barcelona being held on November 5 - 9, 2007. LINQ Luminaries Luca Bolognese, Mike Taulty, and Bart De Smet are among the presenters. This post eliminates the need to register to open and search the EMEA Events page for the conference.

Added: October 9, 2007

Dinesh Kulkarni Addresses Attach()/Detach() Confusion in LINQ to SQL Projects

Dinesh's Attach() if you have something detached post of 10/8/2007 attempts to clear up the confusion surrounding use of the DataContext.TableName.Attach() method in stateless ASP.NET and Windows Communication Foundation (WCF) service projects. Dinesh attributes much of the confusion to the term detached object support, which he characterizes as a "misnomer." As an example, Dinesh cites

  • 8. Streamlined and enhanced support for detached objects (see Attach() APIs) for multi-tier apps

in his LINQ to SQL (fka DLinq): What's new in Orcas beta2 post of July 26, 2007. This post appears to be the result of the quest for a:

  • 6. A story for detached object - this is handy for stateless situations like ASP.NET, web services etc.

which appears to have been the most favored DLinq feature from Dinesh's DLinq: What's cooking in the kitchen post of March 16, 2006.

Java's Hibernate and .NET's NHibernate object/relational mapping (O/RM) tools offer detached object support. Here's the definition from Sun Microsystems' J2EE Persistence: Explore Your Persistence Options presentation by Sang Shin:

  • Detached Objects – Instances that lose association with persistence manager when you close() the session
  • Hibernate allows for selective reassociation of a subgraph. [For example,] you may serialize objects to the web tier, then serialize them back to the EJB tier in the next request.
  • Reference to detached object outside of a transaction/persistence manager can be
    retained and reassociated with a new persistence manager.

Note: For more about detached objects in Hibernate, see section 4.1.3 Detached objects on page 142 (Chapter 4) of Hibernate in Action by Christian Bauer and Gavin King (Manning, 2005).

Hibernate and NHibernate are mature, widely used, and the standard of comparison for O/RM tools. What's interesting is that LINQ to SQL doesn't support selective reassociation of a subgraph or reassociation with a a new persistence manager. Reassociation appears to be explicitly verboten (by exception) in the RTM version.

Perhaps the confusion about detached objects arises from differences in definition between LINQ to SQL and Hibernate.

Another source of confusion might be the bug in LINQ to SQL Beta 2 that causes entities associated with a newly-attached root entity to be inserted rather than assumed to be persisted in the database and awaiting update. For more details, see Feedback: Incorrect Update Behavior - Attaching an Entity after Calling a Relationship Property of August 27, 2007 (resolved as fixed on September 5, 2007) and Rick Strahl's Complex Detached Entities in LINQ to SQL - more Nightmares post of October 1, 2007. If the LINQ to SQL team delivered their long-promised sample project to demonstrate LINQ to SQL with WCF services, they might have discovered the issue before locking down the Beta 2 bits. (This assumes that the example included associated entities, which seems to be uncommon in sample projects.)

Note: See sample WCF project issues with LINQ to SQL and Entity Framework in my "From the 'Talk is Cheap' Department" subhead of the "Julie Lerman Demonstrates Detached Updates with Entity Framework" of LINQ and Entity Framework Posts for 9/28/2007+ post.

Stay tuned for a LINQ to SQL/WCF test harness that demonstrates this bug.

Added: October 9, 2007

Julie Lerman on Persisting Entity Framework Object Graphs in ASP.NET ViewState

Julie's Entity Framework object graphs and viewstate of October 5, 2007 confirms that Entity Framework object graphs can be binary-serialized into an ASP.NET page's Viewstate property value. Unlike with conventional XML serialization, which ignores associated objects, Viewstate preserves associations but not root object state. ObjectContext (like DataContext) objects can't be serialized.

Julie also discovered that viewstate synchronizes object updates:

One saving grace is that objects stored in viewstate get updated automagically during postback. In other words, if I create a cust object and store it in viewstate, then make a change to the cust object, then postback and pull the object back out of viewstate, it will have the newer property values. Viewstate is synced up to the object.

I'm sure we'll hear more on this topic after Julie delivers her Accessing Data Services in the Cloud with Astoria presentation to REMIX07 Boston today (2:30 - 3:45 p.m.)

Added: October 9, 2007

Dom Demsak and LINQ to XML Parts 1 and 2 on DNR TV

From the "How Did I Miss This" Department

Dom Demsak (DomXML) recorded two episodes of "Dom Demsak and LINQ to XML" for Franklins.net's DotNetRocks TV:

Don lists his "great takaways" from the series in his .Net Rocks - XML Literals - You Got VB In My XML post of September 11, 2007.

Subscribe to: Comments (Atom)
 

AltStyle によって変換されたページ (->オリジナル) /