Showing posts with label Visual Studio 2008 Service Pack 1. Show all posts
Showing posts with label Visual Studio 2008 Service Pack 1. Show all posts

Sunday, August 31, 2008

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

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

Update 8/30/2008 to 9/1/2008: Additions and updates
Update 8/29/2008: Additions
Update 8/28/2008: Additions
• Update 8/27/2008: Additions
Update 8/26/2008: SSDS is back on line as of 13:30 PDT

Entity Framework (EF)

•••• Julie Lerman’s EF Business Classes in ASP.NET Apps - Don't pass that query around! post of 8/31/2008 recommends that developers using EF

Return Results, not Queries from the Business classes

by forcing iteration by invoking the ToList(), FirstOrDefault() or similar method, or looping through a foreach structure.

•••• Shawn Wildermuth dispels The Fable of the Perfect ORM on 8/30/2008. He points out that at least the following factors enter into the selection of the object-relational mapping tool:

  • Functional Requirements
  • System Requirements
  • Skill-set of the Development Team
  • Business Factors
  • Time-to-Market
  • Business Culture
  • Lifetime of Project
  • Volatility of Schema

Shawn goes on to give examples of criteria for using LINQ to SQL, NHibernate, LLBLGen Pro, or Entity Framework.

•••• Julie Lerman’s More on Foreign Keys in EF post of 8/30/2008 describes a partial class to return the scalar value of a foreign key from an EntityReference. Foreign key values are useful for specifying associations with dropdown lists. (LINQ to SQL delivers foreign key values by default.)

•••• Matthieu Mezil demonstrates in his EF and WPF post of 8/29/2008 part of the code required for a WPF master-details application that enables using a combo box to choose the master for the details window.

••• Julie Lerman finds EntityKeys are case sensitive in her 8/29/2008 post. Improperly cased keys and property names return

  • The member with identity 'NWentities' does not exist in the metadata collection.
    Parameter name: 'identity'
  • The required entry 'customerID' was not found in the provided input. This entry is required by the key fields defined on type 'NWModel.Customer'

exceptions, respectively.

••• Matthieu Mezil strikes again on the table-per-hierarchy inheritance model in TPH Is Not NULL mapped on a relationship of 8/29/2008.

MaĆ­ra Wenzel's Handling Null Database Values Using Data Source Controls tip of 8/28/2008 notes that:

This topic Handling Null Database Values Using Data Source Controls has now been updated on MSDN to fix the sample based on various customer feedback. You can still see the old version here, in case you're curious to compare both versions.

Her post provides the details on what changed.

•• Matthieu Mezil continues his investigation of strangenesses in EF’s processing of a simple query in his LINQ To Entities: stranger and stranger post of 8/28/2008.

Jacob Proffitt’s Changing Table Names in an OR/M post of 8/27/2008 explains how to change EF and LINQ to SQL table names to suit a particular naming convention in both O/RMs’ XML mapping files. Jacob finds changing table names in EF is more difficult than LINQ to SQL.

•• Tim Mallalieu partially answered my Availability of Minutes of First "Advisory Committee" Meeting? question on 8/27/2008 in the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum:

We will put something out which will be a recap of the findings.

We we still need to do the final post mortem internally and then publish.

It’s the timetable that’s missing.

ADO.NET Data Services (Astoria)

•••• Shawn Wildermuth’s My ADO.NET Data Services/Silverlight 2 Article on MSDN Magazine post of 8/31/2008 points to his “Create Data-Centric Web Applications With Silverlight 2” article for the “Data Services” section of MSDN Magazine’s September 2008 issue. Shawn says:

What is cool about this approach is that you can issue LINQ queries on the client (in Silverlight 2) that will communicate with Data Services via the REST interface and execute queries and update data on the server.  The substantial difference that you will have to get used to is the use of Asynchronous LINQ queries in Silverlight 2.  Check out the article for all the details.

Marcelo Lopez Ruiz adds his two-cents to the Astoria history book with his ADO.NET Data Services History of 8/28/2009.

Vardi posted his Data Service Viewer 1.0 WinForm source code to CodePlex on 8/27/2008. Vardi says:

ADO.NET Data Services Tool help[s] you to create the query URL and view the result.

Marcelo Lopez Ruiz points out that “DateTimeOffset and Time properties are not available as CLR types in ADO.NET Data Services” in his Gotcha with EDM types in ADO.NET Data Services post of 8/27/2008.

Marcelo Lopez Ruiz continues with the reasons to use EF as Astoria’s back end in his timed Another ADO.NET Data Service metadata tip post of August 26. (Marcelo is on a one-week vacation.)

SQL Server Data Services (SSDS)

•••• Roger Jennings recommended that SSDS and Other Windows Cloud Services Should Have Their Own Blogs on 8/30/2008, seconding Ayende Rahien’s proposal of the day before.

Niraj Nagrani, Soumitra Sengupta, and David Robinson deliver A Candid Look at SQL Server Data Services and the Business Scenarios it Addresses in an 8/28/2008 interview by Greg Hughes. The trio tackles the following topics:

  • SSDS isn’t a hosted instance of SQL Server in the cloud, it’s an Internet-based data utility powered by SQL Server
  • Target market is businesses who offer Sofware as a Service (SaaS) applications, including small and medium-sized businesses, with multi-tenancy as an important feature
  • Integration of authentication with the BizTalk Services Identity Provider will be rolled out in the “very near future.”
  • Symmetry with on-premises instances will be outside-in rather than inside-out.
  • SSDS have the capability to hand on-premises data to SQL Server Integration Services (SSIS) and pump it up to the cloud or vice-versa.
  • Microsoft Sync Services will make SSDS into a “data hub.”
  • SQL Server Reporting Services and Analysis Services will be used to deliver reports on uptime, performance and the like.
  • SSDS will grow to 5,000 nodes next year.
  • Open beta will occur shortly after PDC 2008 and SSDS will go live in the first half of 2008.
  • SSDS will be the preferred store of compliance data for large businesses.

•••• Dave Robinson says in SSDS Tech-Ed Online Video Posted of 8/29/2008 that the interview was conducted at Tech•Ed North America 2008, which was held in early June, so the “very near future” appears not so near after all.

•• Soumitra Sengupta discusses Jon Udell’s “continuum of access styles” as it applies to SSDS in his Jon Udell cURL's with SQL Server Data Services post of 8/27/2008.

I’m not sure if just REST and SOAP as wire formats for queries constitute a “continuum,” but supporting AtomPub, JSON, and POX as wire formats as promised might qualify.

Jon Udell’s The continuum of access styles in the emerging Microsoft cloud post of 8/27/2008 mentions his ability to use cURL for basic SSDS navigation with the REST query protocol. Jon concludes:

Microsoft platforms have not historically encompassed the continuum of access styles. Happily, the emerging cloud does. And while the novelty of “just coding to a URL” on a Microsoft platform will undoubtedly attract some tirekickers who otherwise wouldn’t show up, the real draw will be the ability to exercise choice along the whole continuum.

That choice, by the way, is not only relevant to developers accessing hosted, web-facing services. It will matter as much — and with the SOAP option, even more — to developers accessing on-premises services behind the corporate firewall and across corporate boundaries. Facing outward or inward, you’re most productive when you can choose the right access style for the job at hand. Between the realm of the 100% Microsoft coder and the 0% Microsoft coder, a wide and fruitful middle ground is opening up.

Ryan Dunn complements Eugenio Pace’s Concurrency in SSDS post of 8/1/2008 for the SOAP protocol with Concurrency with SSDS via REST of 8/26/2008.

•• Mike Amundsen recounts his problems during the outage in the SSDS is unavailable for all beta users? (2008-08-26 06:00 PDT) [Resolved] thread in the SQL Server Data Services (SSDS) - Getting Started forum.

Roger Jennings’ SQL Server Data Services Beta Encounters First Major Unscheduled Downtime post describes the approximately 7.5 hour unscheduled outage that occurred on August 26, 2008. From the post:

The SSDS team is to be commended for keeping testers up to date on the progress of bringing the service back up. Their response contrasted with Amazon’s failure to alert customers of their February outage, as reported in Amazon Web Services Outage: Causes And Remedies of 2/16/2008.

•• The preceding post has been updated for subsequent events and blog posts and was moved to a separate post due to its increasing length.

Gianpaolo Carraro’s Multi Tenant Data Access (MTDA) Blueprint post of August 25, 2008 announces the availability of the MDTA Blueprint on CodePlex and a Channel 9 interview with Eugenio Pace, the developer. Here’s part of the description:

The Multi Tenant Data Access (MTDA) Blueprint, part of the Software-plus-Services Blueprint program, provides guidance on writing a SQL Server based, single instance, multi-tenant data access layer similar to that used in LitwareHR sample application (SQL Server version).

You need the S+S Blueprints Manager from CodePlex to install the MTDA blueprint. (I was unable to use it with my installation of VS 2008 SP1.)

Note: This blueprint doesn’t use SSDS, as far as I can determine so far.

ASP.NET Dynamic Data (DD)

•• Matt Berseth goes hog wild with home-page menu customization in his A Dynamic Menu For Your Dynamic Data post of 8/27/2008. Matt says:

I have my tables organized into 4 categories: Sales, People, Products and Reports.  And the cool thing is that this menu is completely dynamic.  You can add, remove or reorganize the categories without touching the UI.  And depending where you are keeping your metadata you could even do this without recompiling your app.  The grouping is automatically discovered from the metadata and the menu is built solely off the it so everything 'just works'.

Besides adding the grouping information, I also tagged each of my tables with a custom description that I am displaying under the grids title.  Nothing too complicated, but still interesting.

LINQ to SQL

•••• Damien Guard’s T4 template update for LINQ to SQL in his original post of 8/29/2008 was premature. The latest version will add:

  • Inheritance support
  • VB.NET generation
  • DataContract serialization

But it won’t support stored procedures or composite primary keys.

An updated link in future issue of this post will be provided when the template is fully cooked.

Rob Conery’s Working With Linq's Expression Trees Visually post of 8/29/2008 shows you how to extract and install the Expression Tree Viewer add-in from the CSharpSamples.zip file and use it to view LINQ to SQL expression trees.

•• See Jacob Proffitt’s Changing Table Names in an OR/M post of 8/27/2008 in the “Entity Framework” section.

Simon Segal explains how POCO improves inheritance for LINQ to SQL in his lengthy post of 8/26/2008. He promises:

I will shortly be posting a framework that makes working in a POCO and DDD style much simpler. The Framework includes implemented Specification Patterns, Fetching Strategies and Extensible Repositories for your LINQ To SQL pleasure.

Jeff Atwood recommends adding the NOLOCK statement to SELECT queries to solve a mysterious deadlock problem with LINQ to SQL in his Deadlocked! post of 8/25/2008.

Jonas Stawski recommends being extra-careful when Recreating Entities with Linq To SQL in his 8/25/2008 post.

LinqMaster uncovers an arcane bug with insert triggers and provides a workaround in LINQ to SQL Database Trigger Bug – Workaround of 9/25/2008.

Rico Mariani answers questions by readers of his LINQ to SQL performance analysis series in Linq Compiled Queries Q&A of 9/25/2008.

LINQ to Objects, XML, et al.

••• Bart De Smet goes into excruciatingly detailed coverage of the use of SOS (a.k.a. “Son on Strike”) with dynamic expression trees in his lavishly illustrated To Bind or Not To Bind – Dynamic Expression Trees – Intermezzo: SOS in Visual Studio. Bart says:

In this post I want to point out that you can actually live without that visualizer and go the hard-core way using SOS, … the WinDbg extension for managed code debugging that ships with the .NET Framework (sos.dll). A little-known fact is that SOS can be loaded directly in Visual Studio through the Immediate Window.

•• Martin Hinshelwood says LINQ to XSD is “Absolutely brilliant” in his LINQ to XSD post of 8/28/2008. I’d say the LINQ to XML team would be “absolutely brilliant” if they posted a LINQ to XSD release version instead of Alpha 0.2.

• Bart De Smet’s second post of 8/27/2008, To Bind or Not To Bind – Dynamic Expression Trees – Part 2, delves into IL generation, expression compilation, and emitting code .

Bart De Smet continues his dissertation on dynamic expression trees with To Bind or Not To Bind – Dynamic Expression Trees – Part 1 of 8/27/2008 by creating a DynamicExpression abstract class with MethodCallDynamicExpression, LambdaDynamicExpression and ParameterDynamicExpression factory classes.

Jared Parsons uses a LINQ to XML-powered word-wheel application to demonstrate how to “Increase LINQ Query Performance” in his “Basic Instincts” column for MSDN Magazine’s August 2008 issue.

Ira’s LINQ Distinct, a DataTable and the IEqualityComparer<T> post of 8/26/2008 describes how to write a custom IEqualityComparer<DataRow> for LINQ to DataSet to enable the Distinct() operator to operate on entire rows instead of a single designated column.

Bart De Smet’s To Bind or Not To Bind – Dynamic Expression Trees – Part 0 post of 8/26/2008 is the start of a new series about building dynamic expression trees.

SQL Server Compact (SSCE) 3.5 and Sync Services

No SSCE/Sync Services posts to date.

Visual Studio 2008 Service Pack 1 (General)

• Mike Taulty’s Final .NET Client Profile ( 3 ) post of 8/26/2008 points to his WPF, ClickOnce and the .NET Client Profile Channel9 video of the same date with this description:

A simple demo of building a "Hello World" application with Visual Studio 2008 Service Pack 1 and then deploying it via ClickOnce to a clean Windows XP machine using the .NET Client Profile rather than the full .NET Framework.

Mike Taulty’s The .NET Client Profile post of 8/26/2008 and The .NET Client Profile ( 2 ) of 8/27/2008 cast a jaudiced eye on the process of installing .NET 3.5 SP 1 on client computers with ClickOnce. Mike says:

If you're building something like a .NET WPF client application then one of the major bugbears (for both you and for Microsoft - let's be honest here :-)) is trying to get the .NET Framework on to the client machine.

We're trying to make this easier but if you were to look at the recent .NET Framework packages you'd perhaps not be able to tell that :-)

Miscellaneous (WPF, WCF, Silverlight, etc.)

•••• Phil Haack announces ASP.NET MVC CodePlex Preview 5 Released on 8/29/2008 and says the next release will be the official beta version. The post contains links to other important MVC-related articles.

• Roger Jennings reports problems with Internet Explorer 8 Beta 2’s new Web Slices feature in Fail on First Try of Internet Explorer 8 Beta 2 Web Slices of 8/29/2008. •••• Updated

•• Roger Jennings takes Jaiku’s new Google App Engine implementation to task in Jaiku + Google App Engine = Fail of 8/28/2008. The malformed home page shown in the post, which has lost its CSS content, took over a minute to load.

•• Aaron Skonnard posted Endpoint Screencasts - Hosting WCF Services in IIS to Channel 9 on 8/28/2008:

In this short video, CSD MVP Aaron Skonnard from PluralSight guides the viewer through how to host your WCF Service in IIS. We will start with the simple WCF service that we created in the first screencast, hosting it as an ASP.NET svc file. Aaron then demonstrates adding a couple endpoints (for greater detail, see the screencast on creating WCF endpoints) and accessing the service. Once we have our WCF service hosted in ASP.NET, we add it as an application to IIS for consumption.

The IE Team posted IE 8 Beta 2 for download on 8/27/2008. I installed it to try Web Slices on LINQ and Entity Framework Posts for M/D/YYYY+. The first item in this category recounts my lack of success with implementing Web Slices.

John Papa’s Great Fiddler Tip For Localhost Testing post of 9/26/2008 describes Shawn Wildermuth’s solution to getting Fiddler 2 to recognize the Cassini Web server’s localhost:port number: Prefix the port number with a period.

WebSlice Content for Internet Explorer 8 Beta 2

OakLeaf LINQ and Entity Framework Links

Last Updated: 8/31/2008 2:20 PM PDT

  • Entity Framework Additions
  • SQL Server Data Services Additions/Updates
  • ASP.NET Dynamic Data Additions
  • LINQ to SQL Additions
  • LINQ to Objects, XML, etc. Additions
  • Miscellaneous Additions
    • ASP.NET MVC Preview 5 Released to CodePlex
    • Problems with IE8B2's Web Slices Feature

Monday, August 25, 2008

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

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

Updated 8/25/2008

Updated 8/24/2008

• Updated 8/22/2008

Entity Framework (EF)

•• The Domain.Net Team’s NHibernate 2.0 gold Released – Must Wait for ‘Linq to NHibernate’ post of 8/24/2008 notes that NHibername 2.0 release yesterday without incorporating LINQ to NHibernate. You must download the implementation from a new location, http://sourceforge.net/projects/nhcontrib.

Fabio Maulo’s 21 chapters of NHibernate documentation as a Google Knol offers open contribution under a .

Muhammad Mosa discovers EF’s LINQ to Entities doesn’t support many constructs that LINQ to SQL handles with no problem. His LINQ to Entities, what is not supported? post of 8/24/2008 describes the following problems when migrating the data source of Rob Conery’s sample MVC Storefront project from LINQ to SQL to Entity Framework:

    • Custom Methods & Extension Methods cannot be translated into a store expression
    • LINQ to Entities only support Parameterless constructors and Initializers
    • IEnumrable types cannot be initialized in LINQ to Entities query

You can download Moses’s project from a link on his post.

•• Matthieu Mezil finds that the orderby … descending expression produces unexpected results in his LINQ To Entities: Strange, very strange post of 8/23/2008.

Matthieu Mezil’s TPH limitation which should disappear with v2 post of 8/23/2008 describes an exception when using Is Null and IsNot Null conditions on a table-per-hierarchy inheritence model (see below) that shouldn’t happen and needs fixing in EF v2.

Matthieu Mezil discusses the use of NULL values in the type discriminator column of a table-per-hierarchy inheritance model in his TPH is more than a selection! post of 8/22/2008.

Mikael Henriksson waxes enthusiastic about EF in Entity Framework - The best thing since the wheel? of 8/22/2008. He’s using EF in a real-world project and says:

Entity Framework can't replace working within a well thought through Domain Model but it sure helps me in my everyday work. I just finished a drafting a part of our application that took month and a half to get up and running the first time (I was not involved in the first version). It took me 2 days to come up with a pretty much solid version 2 of that same part.

Mikael claims using EF reduced the 60 developer*day project to 4 developer*days (including 2 days for adding business validation rules)

Ido Flatow shows you how to change CSDL and MSL files programmatically in his Change Entity Framework storage DB schema in runtime of 2/22/2008. Changing files at runtime enables working with experimental, developmental, and production databases without the need to change and recompile your EF code.

Matthieu Mezil explains in How to have a property on ObjectContext which returns the derived entities? of 8/21/2008 how to customize the code generator to add a property for the EntitySet of an inherited property in two passes. However, this later version does the same job in a single pass.

David Yack finds that adding a type declaration for the from clause’s parameter in a LINQ to Entities expression adds a Cast<T> operator to the translated expression in his Entity Framework - Cast Affects Include post of 8/21/2008. The spurious Cast<T> operator caused his Include() method to fail. Removing the type declaration solves the problem.

ADO.NET Data Services (Astoria)

•• Dare Obasanjo’s RESTful JSON: Bringing REST and RPC Closer Together post of 8/24/2008 analyzes comments by Dave Winer and Tim Bray about Dare’s earlier Explaining REST To Damien Katz essay. Dare concludes:

If you put together the notion of service documents with using JSON as the payload format for a service endpoint, you're close to getting the touted programmer friendliness of RPC technologies like XML-RPC & SOAP/WSDL while still building a RESTful service which works with the Web instead of against it.

The only problem is how to deal with statically typed languages like C# and Java. These languages need the types of the objects that application will consume from a Web service defined up front. So if we could just figure out how to come up with service documents for JSON services that included the notion of a class definition, we could pretty much have our cake and eat it to with regards to getting the ease of use of an RPC system while building a RESTful service.

Sounds to me like an interesting development that might apply to Astoria v2 and SSDS.

Marcelo Lopez Ruiz adds another reason why you’ll probably want to use ES as Astoria’s O/RM data source, despite the performance hit when you first spin it up with a large number of objects. His EntityState problems in ADO.NET Data Service post of 8/22/2008 reports:

[I]f you are using a 'T' that's not the ObjectContext-derived type in your DataService<T>, the service won't know you're using an ADO.NET Entity Framework types, and will try to discover types and properties by following references, which eventually leads to the EntityState property problem. Using the ObjectContext type as the 'T' should then solve the problem.

Marcelo Lopez Ruiz demonstrates why the Entity Data Model is Astoria’s default data source in Metadata for ADO.NET Data Services of 8/21/2008: The $metadata resource returns a description of the data model in EDM’s Conceptual Schema Definition Language (CSDL).

Pablo Castro offers a summary history of ADO.NET Data Services in his Timeline of Project Astoria of 8/20/2008 categorized as: Idea, Hack, Pitch, Prototype, Review, Announcement, Team, Design, Release, Future. Makes interesting reading.

Alex Barnett recalls three of his Astoria experiences in How ADO.NET Data Services came to be (formerly known as Project Astoria) of 8/20/2008.

Marcelo Lopez Ruiz explains the DataServiceContext.UsePostTunneling property in POST tunneling in ADO.NET Data Services of 8/20/2008.

Scott Hanselman’s The Weekly Source Code 32- Atom, AtomPub and BlogSvc, an AtomPub Server in WCF post of 8/20/2008 provides more insight into in System.ServiceModel.Syndication and ServiceDocument in the context of the new open-source BlogSvc implementation of AtomPub that’s compatible with Windows Live Writer.

Gil Fink comments on Arnon Rotem-Gal-Oz’s Why the Database as a
Service is a Bad Idea
post in Why Data as a Service isn't a Bad Idea of 8/20/2008 and concludes:

So what is the potential of ADO.NET Data Services?
In a RIA … or data driven application it can help to provide a cleaner solution. The ability of Data Services to return responses in JSON or in URI makes them flexible and usable by Ajax or Silverlight. Also, if the data service is consumed by a .Net client you can use the LINQ to [REST] feature. The Data Services come with other features like concurrency, batch operations over HTTP, full query operation support and more. These features, when used right, can help to provide good solutions for a data driven application.

SQL Server Data Services (SSDS)

Mike Amundsen is Looking for Suggestions on Implementing One-to-Many, Many-to-Many Patterns in SSDS, according to his 8/22/2008 thread in the SQL Server Data Services (SSDS) - Getting Started forum. Hopefully, an SSDS team member will provide insight how the service will emulate joins on the client efficiently. (As I read the tea leaves, there are no plans for the service to implement joins.)

Stephen Wynkoop Challenges with Data Management in the Cloud? article from the SQL Server Worldwide Users Group (SSWUG.org) newsletter of 8/21/2008 suggests that data stored in cloud databases …

can be accessed by serving appropriate warrants or other legal processes to the cloud provider.  In some cases, this can be done without notifying the owner of the information (such as cases where they think that by knowing, the owner could/would/might destroy information). …

Perhaps we need a system where the information stored in the cloud is done so encrypted, with keys that are owned by the information owner only.  That way the cloud provider returns to being just that, a service provider, without having responsibility (or access) for/to the data on their systems.

I believe that this is a topic that the SSDS Team should consider for implementation in v1 RTM but probably requires SQL Server 2008. (The present “CloudDB” runs on modified SQL Server 2005.)

ASP.NET Dynamic Data (DD)

Matt Berseth drills down on the use of DD’s MetadataType attribute in his Dynamic Data and Custom Metadata Providers post of 8/24/2008.

• Scott Hunter’s Image Generation is released to CodePlex post of 8/21/2008 describes the long-awaited ASP.NET GeneratedImage replacement for Whidbey’s (!) DynamicImage feature that got cut from VS 2005. GeneratedImage is an ASP.NET control that automatically generates an ImageHandler and wires the control to its URL. The new control is ideal for use in DD projects.

ImageHandler is an implementation of IHttpHandler that, according to Scott, supports:

  • Transforms (resizing, watermarks, user defined transforms)
  • Client-side caching
  • Server side caching
  • Access to parameters passed from the GeneratedImage control
  • Provide simple mechanics for returning images

• Scott Hanselman’s ASP.NET Futures - Generating Dynamic Images with HttpHandlers gets Easier post of 8/21/2008 provides examples of creating and using the GeneratedImage control.

• Matt Berseth offered yet another ASP.NET Dynamic Data - Simple 5 Table Northwind Example on 8/21/2008. He says:

I am pretty impressed and I am looking forward to exploring this further - stay tuned.

Matt Berseth being “pretty impressed” with DD bodes well for its future.

Josh Heyse uploaded Dynamic Data Filtering v1.01, which eliminates private reflection, to CodePlex on 8/20/2008. Josh says he “worked with the Dynamic Data team to open up several internal method calls to eliminate the need for the reflection.”

You can learn more about Dynamic Data Filtering, which adds:

  • Searching ranges (ListPrice > 10 AND ListPrice < 500)
  • Searching in a list of possible values (Class in (‘L’, ‘M’))
  • Partial text searching (Color LIKE ‘B%’)

to the stock DD filters, from the five-part A Richer DynamicFilterRepeater series on Josh’s blog.

Justin Etheredge’s Exploring System.Web.Routing post of 8/20/2008 is a detailed tutorial on the new URL mapping feature introduced by VS 2008 SP1 for ASP.NET MVC and DD.

LINQ to SQL

••• David DeWinter requests potential users to suggest features for his LINQ to SQL utility that supports updating the object model from the database schema and property-name fixup in his DBML Fixup Preview post of 8/24/2008. David’s current feature list appears to duplicate the LINQ to SQL capabilties of Kris Andersson’s Huagati DBML/EDMX Tools. David has scheduled DBML Fixup for a year-end release.

•• Andrew Davey suggests a set of rules for creating “convention-based mapping” with LINQ to SQL’s XML mapping files to minimize manual authoring in his LINQ-to-SQL Convention Mapping Source post of 8/24/2008

• Beth Massi’s Data on the Smart Client Talk at Bay.NET UG post of 8/21/2008 provides a link to her databinding to WinForms and WPF clients presentation to the Bay.NET user group and its sample code. (The OMS.mdf database file required for the demos is in the …\LINQSQLDemo\OMSDataLayer folder.)

Jim Wooley delves into Object Identity tracking changes with LINQ to SQL SP1 on 8/21/2008 and explains that LINQ to SQL checks the cache before sending a T-SQL query to retrieve a single entity instance.

Simon Segal offers props to LINQ to SQL in The future of LINQ To SQL and showing some support of July 30, 2008 and the bumper sticker below to proclaim solidarity with the first and fastest LINQ O/RM implementation:

which links to Ian Cooper’s Showing some support for LINQ to SQL post of July 2, 2008. Ian says, in part:

I would like to see MS give this product the support it deserves. I would like to see a commitment from the Data Platform team to stop its focus on talking LINQ to SQL down as a RAD tool and tallking up its advantages for use in the OO approaches to software development. For example  I would like to see the Data Platform team talking about LINQ to SQL's support for POCO strategies, lazy loading, etc. and pointing out to customers who request those features. There needs to be more acknowledgement that if you want them you should consider LINQ to SQL.

[I missed these items when originally posted.]

LINQ to Objects, XML, et al.

••• Jim Wooley shows you how to Enable the Expression Tree Visualizer in VS 2008 in his 8/24/2008 post.

•• Damon Wilder Carr’s LINQ to Financial Markets : Optimizing Provider to Real-Time Quotes, Analytics, and Silverlight-WPF Visualization post of 8/22/2008 describes a forthcoming LINQ implementation that offers:

An easier way to consume, visualize, understand and quantify just about any information you can imagine from the world of global financial services.

  • Real-Time stock quotes to Complex Analytics of Multi-Asset Class Portfolios
  • Monte-Carlo simulation with Optional Quantitative Add-Ins
  • Efficient frontier Optimization based on Constraints you Set
  • User defined heuristics from strategic rebalancing to day-trading

Release of the new provider currently is in limbo. Damon says:

Due to the nature of the access to this information, we are still working out the details for the open-source version we plan to offer soon. The world of the owners of this data has not caught up to the philosophy we have for transparency and shared value.

•• Jim Wooley says “LINQ to Reflection isn't really a provider, but just a specific implementation of LINQ to Objects which happens to query reflection information” in his LINQ to Reflection IsNot LinqProvider post of 8/23/2008.

• Eric White’s Using LINQ to XML to Retrieve Content Controls in Word 2007 post of 8/21/2008 shows you how to write a LINQ query to retrieve the contents of Word 2007’s content controls.

Bart De Smet gets the Longest Post Title Award for What Do VB 9.0 Error “BC36593: Expression of type ‘X’ is not queryable.” And C# 3.0 Error “CS1936: Could not find an implementation of the query pattern for source type ‘X’.” Really Mean? of 8/20/2008. His essay explains in granular detail what these VB (!) and C# error messages mean.

Mike Ormond discovers in his LINQ to JSON post of 8/21/2008 that LINQ to JSON from Silverlight’s System.Json namespace saves a lot of code because he doesn’t need to define a .NET type to represent the JSON object.

SQL Server Compact (SSCE) 3.5 and Sync Services

No SSCE posts as of 11:00 PDT. 

Visual Studio 2008 Service Pack 1 (General)

Scott Hanselman’s SmallestDotNet: On the Size of the .NET Framework post of 8/23/2008 describes options for upgrading client PCs to .NET Framework 3.5 with installers that range in size from 10 MB to 56 MB, depending on the client’s current versions. Scott also describes the Client Profile:

The Client Profile is an even smaller install option for .NET 3.5 SP1 on XP. It's small 277k bootstrapper. When it's run on a Windows XP SP2 machines with no .NET Framework installed, it will download a 28 meg payload and give you a client-specific subset of .NET 3.5.  If the Client Profile bootstrapper is run on a machine with any version of .NET on it, it'll act the same as the 3.5 SP1 web installer and detect what it needs to download, then go get it.  There's more details in the Client Profile Deployment Guide.

Scott also announces his new SmallestDotNet page that executes a small chunk of JavaScript to inspect your browser’s UserAgent and determine what version of the .NET Fx is installed. The script reports the total size of the download to update to .NET Fx 3.5.

Microsoft Downloads offers the Visual Studio 2008 SDK 1.1 as of 8/20/2008:

The Visual Studio 2008 Software Development Kit (SDK) 1.1 includes tools, documentation, and samples for developers to design, build, test and deploy extensions for Visual Studio 2008 Service Pack 1. You can also use the Visual Studio 2008 SDK 1.1 to create custom tools environments based on the Visual Studio 2008 Service Pack 1 Shell.

Miscellaneous (WPF, WCF, Silverlight, etc.)

The SQL Server Worldwide User Group (SSWUG.org) will present a .NET Virtual Conference on October 28-30, 2008. Presenters include .NET and EF luminaries such as Kathleen Dollard, Ben Hoelting, Tim Huckaby, Tim Huer, and David Yack.

Dare Obasanjo’s Some Thoughts on Amazon's Elastic Block Store essay of 8/21/2008 about Amazon’s new EBS service, which provides 1 GB to 1 TB blocks of persistent storage that you can format as a file system, concludes:

EBS is the final piece in the puzzle that had prevented Amazon's cloud computing platform from being comparable to traditional hosting solutions. With EBS Amazon is now superior to most traditional hosting solutions from a developer usability perspective as well as cost. Google App Engine now looks like a plaything in comparison. In fact, you could build GAE on top of Amazon's cloud computing platform now that the EBS has solved persistent custom storage problem.

Werner Vogels, Amazon’s CTO, announced that Amazon EBS - Elastic Block Store has launched on 8/20/2008. His post contains additional details about EBS. Vogels announced plans to create EBS in his Persistent Storage for Amazon EC2 post of 4/13/2008.

Thursday, August 14, 2008

Upgrading Databound Projects to Entity Framework V1 RTM Doesn’t Expose DataSource’s 1:Many Associations

If you start your WinForm project with bound master-child[-grandchild] controls in a new project created with Visual Studio 2008 SP1 and using Entity Framework RTM as its data source, the nodes representing hierarchical 1:Many associations behave identically to those for typed DataSet and LINQ to LINQ to SQL data sources.

Update 8/17/2008: The “An error occurred while performing the drop” message disappeared when recreating the data sources a second time. However, data sources based on EntityCollections (one:many associations) still throw errors when attempting to set the BindingSource.DataMember with code and the DataMember property value choice appears as None in the BindingSource properties sheet.

Here’s a capture of the properties window with the missing DataMember property value choice for the ordersBindingSource as the DataSource property value of the order_DetailsBindingSource:

 

The DataSource code inserts the Order_Details DataMember value; you can’t select it or, in some cases, set it in code. For example,

ordersBindingSource = customerBindingSource;
ordersBindingSource.DataMember = "Orders";

throws a "Cannot bind to the property or column Address on the DataSource. Parameter name: dataMember" exception.

Updated 8/14/2008: Runtime exception details added.

For example, when you add to the Data Sources window a Customer EntitySet persisted to the Northwind.Customers table, you can drag the Customer.Orders node to the form to generate an orderBindingSource and bound orderDataGridView. In this case, orderBindingSource.DataSource = customerBindingSource and orderBindingSource.DataMember = “Orders”.

Links between the Customer EntitySet and Orders EntityCollection, BindingSources and DataGridViews are shown here in VS 2008 SP1 (Click image for full-size screen capture):

Similarly, dragging the Customer.Order.Order_Details node to the form generates order_DetailBindingSource.DataSource = orderBindingSource and order_DetailBindingSource.DataMember = “Order_Details”. Binding the two BindingSources to the associated EntityCollection synchronizes the orderDataGridView to the selected Customer entity and the order_DetailsDataGridView to the selected Order entity.

Problems with an Upgraded WinForms Project

Upgrading a pre-VS 2008 SP1 project to take advantage of EF v1’s new databinding enhancements by replacing the *.edmx file and its *.designer.cs or .vb partial class file with a new one requires you to:

  1. Delete the existing *.edmx file and its related files
  2. Delete the now-empty data sources from the Data Sources window
  3. Create a new *.edmx file in the EDM Designer
  4. Change the EDM partial class namespace from *Model to ProjectName
  5. Add new data sources to the Data Sources window
  6. Create new binding sources for child [and grandchild] DataGridView controls by dragging EntityCollection nodes to the form in design mode

Attempting step 6 for, as an example, the Customer.Orders EntityCollection, throws the following exception:

as noted in an update to my recent The Joys of Installing Visual Studio 2008 Service Pack 1 post.

Update 8/15/2008: Attempting to set the BindingSource at runtime with the following code:

order_DetailBindingSource = orderBindingSource;            order_DetailBindingSource.DataMember = "Order_Details";

throws a “The method or operation is not implemented” exception at runtime.

Most experienced .NET developers tend to avoid drag-and-drop databinding like the plague, but it’s handy for hooking up lightweight EntityCollections guaranteed to have a relatively few rows, such as line items of sales orders, invoices, or purchase orders. Line items must all be visible to create a meaningful UI for the user, while specific orders or groups of orders for a customer can be downloaded as required.

Having to perform major surgery on existing applications to take advantage of a new and needed feature is painful.

Serious Fail of ASP.NET Dynamic Data SP1 with Entity Framework v1 RTM Data Source

Update 8/18/2008: Scott Hunter of the DD Team posted to the Dynamic Data Entity Framework Workaround thread 0f 8/16/2008 a message with a link to the workaround in CodePlex for the "A property with name 'XX.Id' does not exist in metadata for entity type 'XX.XX.XXXX'” exception with the Entity Framework as a data source.

For more information about the workaround, see Workaround for Dynamic Data Entity Framework Posted post of 8/16/2008.

Apparently the DD team tested their SP1 release only with LINQ to SQL as the data source. This is surprising when you consider the emphasis the Data Programmability group is placing on Entity Framework.

I’ve tested Microsoft.Web.DynamicData.dll (the replacement for System.Web.DynamicData.dll) and the revised RegisterContext() method. It fixes the problem for me. The updated version of the DynamicDataWebApp project has been incorporated in a replacement for the VS0808RJ.zip file that should be posted at http://code.visualstudiomagazine.com/vs0808rj.zip shortly. The DynamicDataWebSite file-system project uses LINQ to SQL as its data source, so it wasn’t affected by the DD team’s gaffe.

In the meantime, you can download the updated code from SkyDrive.

Original Content Starts Here

A reader of my “Generate Web Sites Automatically” cover story for the August 2008 issue of Visual Studio Magazine reported today that the accompanying sample code threw a runtime exception under VS 2008 SP1 when clicking the View Order_Details link of the Orders list page shown below (click image for a full-size capture):

The “A property with the name ‘Order.OrderID’ does not exist in metadata for entity type ‘NorthwindModel.Order_Detail’” runtime error appears as follows (click for full size):

This problem was reported on August 13, 2008 in Dynamic Data SP1 chokes on Northwind and AdventureWorks using ADO.Net Entity Data Model thread or the ASP.NET ASP.NET Dynamic Data forum. According to David Ebbo’s reply on the same date:

There is indeed an issue with the Entity Data Source that is causing this. Here it is described by someone from the Entities team:

"Currently for a (1 : 0..1) relationship, we expose references to the “1” end but we don’t expose the references to the “0..1” end. For ex: consider something like “Person”->”PersonDetails” with a (1 : 0..1) relationship between them:

There will be a property descriptor “Person” on “PersonDetails” entity. However there’ll be no property descriptor called “PersonDetails” on “Person” entity."

We'll see if there are some possible workarounds.  BTW, you mention that you also see this with Northwind.  Specifically, which Northwind table are you seeing this on?

It appears to me that the problem differs from the description above. The multiplicity of the Order:Order_Details relationship is 1:*, and there is no reason for an attempt to read the Order_Details.Order.OrderID value from the associated (1:0..1) EntityReference.

If there aren’t “some possible workarounds” available immediately, this will be a serious blow to the Data Programmability group’s attempt to position the Entity Framework as the preferred data source for new programming frameworks, such as ADO.NET Data Services (Astoria).

In the event there’s no prospect for a timely workaround, I’ll change the data source for the sample projects from Entity Framework to LINQ to SQL and update the sample code accordingly.

Wednesday, August 13, 2008

The Joys of Installing Visual Studio 2008 Service Pack 1

The following is a better location than MSDN Subscriptions from which to download Visual Studio 2008 Service Pack 1 (SP1) and .NET Framework 3.5 SP1 Downloads.

Updated 8/12/2008: Clarification of MSDN Library download and saga of the failure of my initial upgrade and 8/13/2008: “An error occurred while performing the drop” error message added.

Problem 1: You’ll probably encounter the following Microsoft Visual Studio Patch Removal Tool message when you attempt to run the installer:

Here’s a link to the Visual Studio 2008 Service Pack 1 (SP1) Readme.

Update 8/12/2008: You need about 3.7 GB of free drive space to run the SP1 installer.

Problem 2: My first couple of attempts to download and install the “Microsoft Visual Studio Patch removal tool” incurred a not-found message, which others had apparently encountered (see the Visual Studio 2008 SP1 RC: Patch Removal Tool link doesn't work message in the Connect forum.)

Ultimately, I was able to download and run the Visual Studio 2008 Service Pack Preparation Tool shown here:

Downloading required about 13 minutes on a ~3 mbps DSL connection; installation required about 25 minutes on a moderately fast machine and 45 minutes on an older Dell server.

Problem 3: You’ll need the original media from which you installed VS 2008. (This reminds me of Office 2000 + service packs and updates.)

Problem 4: Online Help files are a separate 2.15 GB download. Click the MSDN Library for Visual Studio 2008 Service Pack 1 (x86, x64 WoW) - DVD (English) link in the “Top Subscriber Downloads” of the MSDN Subscriptions Page. (The link in the Readme’s section “2.1.7 Visual Studio 2008 SP1 will not install MSDN Library for Visual Studio 2008 SP1 during Setup” returns a 404.)

Update 8/12/2008: Help download point corrected. It appears that the Visual Studio team isn’t proud of their updated VS 2008 SP1 help file; they’re certainly doing their best to hide its download point. There should be a link to download the MSDN Library for SP1 on the main download page.

Problem 5: According to Amy Dullard’s Silverlight Tools Must be Updated After Installing Visual Studio 2008 SP1 blog post of August 11, 2008, you’ll also need to update your Silverlight 2 Beta 2 toolkit from http://go.microsoft.com/fwlink/?LinkID=120032.

Update 8/12/2008: Problem 6: My initial upgrade to my primary development machine failed, despite the fact that the install log said that the upgrade succeeded. .NET Framework showed SP1 in Programs and Features.

The first symptom of the failure I found was an error when I attempted to use the Entity Framework’s new data-binding feature. When attempting to drag the Customers.Orders node from the Data Source window to a form to add and ordersBindingSource component and ordersDataGridView control I received the following error message:

Failed to get properties of data source ‘Orders’ because of the following error:

Requested Operation is not allowed when the owner of this RelatedEnd is null. RelatedEnd objects that were created with the default constructor should only be used as a container during serialization.

Another indicator of a problem is Visual Studio 2008 SP1 Beta 1 as the product name in the Help | About dialog.

Update 8/13/2008: Problem 7: After upgrading a complex master/details/subdetails form created with VS 2008 SP1 Beta to SP1 RTM, which was no walk in the park, attempts to replace a Beta BindingSource/DataGridView by dragging the related association node to a Windows form throws this design-mode exception:

The help topic for this exception says:

When dragging items from the Data Sources window onto controls, the items must be valid drop sources for the control. For example, you cannot drag a TextBox onto a Button.

Clearly a form is a valid drop source for the BindingSource/DataGridView combination.

Note: The preceding error message is the same as that for problem 6 except for the first paragraph.

Update: Guy Burstein’s .Net Framework 3.5 SP1 and Visual Studio 2008 SP1 are Available! post of August 11, 2008 has links to many SP1-related resources.

LINQ and Entity Framework Posts for 8/12/2008

Note: Due to the volume of VS 2008 SP1 items, this post covers only August 12, 2008 content in an abbreviated format.

Entity Framework v1

Alex JamesStructural Annotations - One Pager explains changes in store for SSDL and CSDL schema annotations to support other EF applications, such as Reporting Services. Alex asks at the conclusion, “Do you think you will find a use for Structured Annotations?”

Kris Andersson continues his Designing an airline passenger reservation system series with Application Architecture - Part 5a - Data Access Layer - A closer look at ADO.NET Entity Framework, which describes his attempt to create a Entity Data Model from an SQL Server database with 1000+ tables and 2000+ associations. After six hours he gave up. Kris promises:

The next article in this series (5b) will re-visit the performance comparison between EF and Linq to SQL that Roger Jennings performed on the beta. I am hoping that the beta version was slowed down by debug code and that the RTM version will be faster / have less overhead.

Julie Lerman analyzes the ADO.NET Team’s What's new in the VS 2008 SP1? post of 8/11/2008 in her Entity Framework changes between SP1 Beta and RTM post.

Jeff Derstadt supplies a list of Entity Framework RTM Breaking Changes classified as Provider Changes, Entity Services Changes, Mapping and Metadata Changes, EntityDataSource Changes and Tools Changes categories.

Danny Simmons has updated his Entity Framework FAQ for SP1 in EF FAQ updated. So far, I haven’t found any documentation or other information about the new data binding features.

Julie Lerman describes the strangely named EF: GetRelationTypeExpensiveWay method, announces two new sites to support her forthcoming book (LearnEntityFramework.com and ProgrammingEntityFramework.com), and discusses her most recent 14-page Article: Data Access Options in Visual Studio 2008 in the September/October 2008 issue of CoDe Magazine. (The article’s available in print but isn’t on line yet.)

ADO.NET Data Services (Astoria)

Guy Burstein shows how easy it is to add a Service Reference to an ADO.NET Data Services back end in VS 2008 SP1: Add Reference to ADO.Net Data Service and WCF Service Contract changes in WCF Service Contract Refactoring affects Configuration File in VS2008 SP1.

Mike Flasko describes the maddening issue of the Silverlight Client Library’s incompatibility with ADO.NET Data Services SP1 in Compat Note: Silverlight Beta 2 Client & .NET Framework 3.5 SP1 Server Components. If you install VS 2008 SP1, your out of luck when attempting to use a Silverlight 2 front end with Astoria SP1.

Marcelo Lopez Ruiz explains how the DataServiceContext’s IgnoreMissingProperties property immunizes Astoria projects from breaking when the server implements a new property in Ignoring server properties.

SQL Server Data Services

DRD’s Performance of Soap compared to Rest post in the SQL Server Data Services (SSDS) - Getting Started forum confirms an approximate 2:1 difference in SOAP and REST upload performance that I reported in my Updated SQL Server Data Services (SSDS) Test Harness: Northwind REST and SOAP Uploads post of

Mike Amundsen has started an SSDS FriendFeed Room for “Conversations around SQL Server Data Services.” It’s public, so anyone can join.

ASP.NET Dynamic Data

No articles found.

LINQ to SQL

Matt Manela provides the code for “generic methods for inserting and updating a detached entity into a database using LINQ to SQL” in Generic Insert and Update for LINQ To SQL.

Robert Cain promises a future post to show how to access SQL Server Compact 3.5 from LINQ to SQL in Getting Started with SQL Server Compact Edition 3.5. (LINQ to SQL is a far more rational choice as an O/RM for SSCE than Entity Framework.)

Update 8/13/2008: Rosor Demonstrates a Heterogeneous Join in LINQ with VB.NET: Join SQL with a CSV file or List of objects.

LINQ to Objects, XML, et al.

No articles found.

Miscellaneous

Steve Lasker answers the question: Why does VS 2008 SP1 not include SQL Server Compact 3.5 SP1 64bit?.

Update 8/13/2008: Steve updates his answer with Why doesn't Visual Studio 2008 SP1 installer update SQL Server Compact 3.5 for Devices?

Liam Cavanagh describes 2 New Sync Samples - Download Only & Adapter Builder for Sync Services for ADO.NET v2.