Sunday, September 21, 2008

LINQ and Entity Framework Posts for 9/15/2008+

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

Updated 9/20/2008 and 9/21/2008 Additions EF, Astoria, LINQ to Objects, SSDS, etc. 
Updated 9/19/2008 8:30 AM PDT Additions LINQ to SQL, SSDS
Updated 9/18/2008 8:30 AM PDT Additions SSDS
• Updated 9/17/2008 9:30 AM PDT Additions

Entity Framework and Entity Data Model (EF/EDM)

•••• Roger Jennings demonstrates Huagati System’s Huagati DBML/EDMX Tools for solving EF v1’s EntitySet pluralization issue (below) in his Singularizing EntityType and Pluralizing EntitySet Names with the Huagati DBML/EDMX Tools post of 9/21/2008.

•••• Roger Jennings complains about arbitrary and capricious renaming conventions for EF EntitySets in his Forcing Gratuitious Pluralization of EF EntitySet Names Was a Very Bad Decision post of 9/20/2008.

• Julie Lerman correctly defines niladic as “having no arguments” in her EDM Stored Procedures - what the heck is niladic? post of 9/17/2008. Niladic, monadic, and dyadic functions have 0, 1, and 2 arguments, respectively. SQL Server uses the term niladic to refer to system functions, such as @@identity or @@error, which is probably where the Data Programmability group came across it. I recall use of the term in conjunction with APL programming in the late 1970s.

• Matthieu Mezil reports in his TPT with designer can generate errors 3034 or 3021 post of 9/17/2008 that the EDM Designer has problems with a pair of scenarios for the Table per Type inheritance model.

Beth Massi uses Entity Framework as the data source for her Editing Tabular Data in WPF - Building a WPF Grid post of 9/15/2008. Beth explains how the WPF ListView and BindingListCollectionView combine to create an editable WinFoms DataGridView clone.

It’s unfortunate that there’s no drag-and-drop wizardry to generate a codeless WPF project. You must write all the XAML yourself (or copy it from Beth’s post.) Alternatively, you can download the code for this and a previous post, Editing Tabular Data in WPF Using the Winforms DataGridView, from the Editing Tabular Data in WPF item on MSDN Code Gallery.

LINQ to SQL

Jim Wooley’s Enabling intellisense for LINQ to SQL XML Mapping files post of 9/18/2008 explains how to obtain and install the LinqToSqlMapping.xsd schema file to support the xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007" namespace if it’s missing from your installation of VS 2008 SP1’s \Program Files\Microsoft Visual Studio 9.0\Xml\Schema folder.

This problem was reported in a Microsoft Connect bug report, which was acknowledged by Microsoft as a known bug. However, it wasn’t missing from my installation.

Damien Guard released the latest update to his LINQ to SQL template for Visual Studio 2008 on 9/14/2008. Damien says:

If you want to customize the LINQ to SQL code generation phase in your project without additional tool dependencies this could be what you’re looking for. The template has been improved since publication with fixes for column mapping defaults, enum parsing and now generates stored procedure wrapper methods.

This Text Template Transformation Toolkit (T4) version offers the following new features:

    • Inheritance - generates subclasses with all properties and code mappings.
    • VB.NET - CSharpDataContext.tt is joined by a VB.NET emitting VBNetDataContext.tt.
    • DataContract SP1 – additional mode to emit SP1-compatible DataContract serialization via Roger Jennings.
    • Composite keys – both as the primary key and as a foreign key in an association.
    • Type attributes – the data context and entity types can now be sealed or abstract as well as public, private, protected, internal or protected internal.
    • Associations – prevents foreign key values changing once the object association is made and updates parent side of one-to-many associations.
    • Stored procedures – generates the method wrappers complete with parameters etc.

  Damien added in a message and blog update of 9/18/2008 that the version current as of 9/19/2008 has “full stored procedure support which actually works with concurrency checking (unlike SqlMetal’s which silently fails.)

LinqMaster’s How to Speed Up LINQ to Sql With Compiled Queries post of 9/15/2008 reminds us that compiling LIQ to SQL queries speeds their execution, as Rico Mariani discussed in his famous quintet of posts on the same topic.

LINQ to Objects, LINQ to XML, et al.

•••• Damon Wilder Carr delivers LINQ to GAC in his Linq to Gac : Use Linq to Power Query your Gac via this C# Bridge to Fusion team domain.dot.net post of 9/20/2008 to “get LINQ access to the GAC with no fuss.”

•••• John Papa describes a LINQ to Objects query that mashes items from several different feeds together (from an ObservableCollection<SyndicationFeed> type), and sorts them by date in his LINQ to RSS/ATOM (Kind of) post of 9/20/2008. John says:

Its pretty basic LINQ, but when combined with the way cool SyndicationFeed and SyndicationItem classes, I think its pretty darn awesome.

I agree; it nicely demonstrates the ubiquitous nature of LINQ queries.

•• Ken Getz’s recent “Advanced Basic” columns for MSDN Magazine provided yet more coverage of LINQ Enumerables:

  1. The LINQ Enumerable Class, Part 1 (July 2008) was “a quick tour through half of the methods in the Enumerable class.”
  2. The LINQ Enumerable Class, Part 2 (September 2008) “digs into the System.Linq.Enumerable class and shows readers how to perform some magic data operations using System.Linq.Enumerable.”

Is there any indication of when readers will say enough to LINQ to Objects rehashes? However, Ken’s are better than most.

• Eric White observes in his Congratulations to a Couple of Cool People post of 9/16/2007 that “the strongly typed XML programming API of version 2 of the Open XML SDK was very much inspired and influenced by LINQ to XSD,” but “[s]o far, LINQ to XSD hasn't become a supported product.”

It’s time for the Data Programmability group to move LINQ to XSD out of hibernation as an alpha product and support it!

Paul Stovell reports on his progress in simplifying Bindable LINQ by removing multi-treaded operation and substituting synchronous dispatchers in Bindable LINQ: Threading of 9/16/2008.

Bart De Smet’s strangely named Who ever said LINQ predicates need to be Boolean-valued? post of 9/14/2008 is a paean to LINQ’s flexibility that covers these topics:

  • The LINQ provider spectrum: Completely local to completely remotable
  • LINQ as a language pattern: “Just like foreach, lock, using, etc are patterns on top of other stuff (IEnumerable, Monitor, IDisposable, etc).”
  • A different view on predicates: Where as a filtering operator
  • Taking it across the border: IQueryable (or something like it)
  • Staged migration of query languages: LDAP’s ~= operator, CAML’s DateRangesOverlap() method
  • Conclusion: Six ways to write LINQ-aware APIs

ADO.NET Data Services (Astoria)

•••• Keith Pijanowski’s My talks on REST and S+S at VSLive New York 2008 post includes links to his “RESTful Services with Windows Communication Foundation” presentations a VSLive! New York. It also has links to download Nikhil’s Web Development Helper, which “provides a set of tools and utilities for the Web developer, esp[ecially] Ajax and ASP.NET developers,” and links to Rob Bagley’s 10-part REST in WCF blog series.

•••• Mike Taulty posts sample code from his REMIX UK sessions on Silverlight and WPF in his REMIX UK - "No Silverlight Application is an Island" Code post of 9/20/2008:

  1. Interacting with the HTML DOM and Javascript. Project download.
  2. Interacting with the local machine via the file dialog and Isolated Storage. Project download.
  3. Interacting with a SOAP based web service. Project download.
  4. Interacting with a RESTful web service. Project download ( note, there's some small bits of SQL to run to make this one work - in a sub-folder called SQL ). Note also you'll need the updated Silverlight client bits for ADO.NET Data Services.
  5. Interacting with RSS/ATOM. Project download ( note, I skipped by this one yesterday as I was running out of time ).
  6. Interacting with Sockets. Project download.

•• Richard Blewett’s three-part “Why REST Web Services?” article on the rejuvenated Developer Fusion site analyzes the trade-offs between SOAP and REST SaaS applications:

  1. What's wrong with SOAP
  2. What is REST?
  3. Is REST perfect?

• Daniel Pratt reports that the RTM version of Astoria with Entity Framework as the data source doesn’t support navigation properties on derived types in his Navigation properties on derived types message of 8/24/2008 in the ADO.NET Data Services (Pre-Release) forum. Microsoft’s Pratik Patel says:

[T]his didn't make it for the V1 timeframe. We really wanted to support this so that users can use inheritance in the entity model. This is one of the most important features we are targetting for V2. V1 just went out, so it will be some time before we do a beta/ctp for the next release.

Thanks to Matthieu Mezil for the 9/17/2008 heads up on that message.

ASP.NET Dynamic Data (DD)

•••• Matt Berseth now has links to live demos of his five DD demonstration projects on his Dynamic Data Demos Now Available post of 9/21/2008/. Most of the demos have substantial customization applied.

Rick Anderson of the ASP.NET User Education (UE) group has posted a detailed analysis of the Differences When Working with the ADO.NET Entity Framework to LINQ to SQL with ASP.NET Dynamic Data (ANDD). This post is a must-read for developers considering using EF instead of LINQ to SQL as the data source for ANDD. (LINQ to SQL was the only data source for early ANDD versions.)

Some highlights:

  • Many-to-many relationships don’t support navigation; a relation table is required.
  • Complex types aren’t supported.
  • ANDD doesn’t detect auto-generated (int identity or rowguid) primary keys; a partial class for the Insert page with a Scaffold value of false for the primary key field is required
  • ListView controls require special treatment of foreign key fields

This post hasn’t received the attention it deserves.

Matt Berseth substitutes the Yahoo! User Interface (YUI) JavaScript library’s DataTable and DataSource controls for DD’s DataGrid and EntityDataSource or SqlDataSource controls in his Dynamic Data - Experimenting with YUI's DataTable and DataSource Controls post of 9/15/2008.

Steve Naughton supplements his early July FileImage_Edit FieldTemplat posts with Dynamic Data: Part 3-FileUpload FieldTemplates of 9/15/200, which let you:

  • Upload a file to a specified folder.
  • Download the said file once uploaded.
  • Display an image for the file.
  • Control the download capability via attributes and user Roles.
  • Handle errors such as wrong file type or when file is missing from upload folder.

SQL Server Data Services (SSDS)

•••• Keith Pijanowski, Microsoft strategy platform advisor, outlined the high-level architecture strategy in a session entitled "Navigating the Software Plus Services Landscape" to Kathleen Richards, senior editor of Redmond Developer News and Application Development Trends as reported in her VSLive! NY: A Glimpse of .NET Framework in the Cloud story of 9/10/2008.

His My talks on REST and S+S at VSLive New York 2008 post of 9/9/2008 include links to his “Navigating the Software plus Services Landscape” and “RESTful Services with Windows Communication Foundation.” (See the related Astoria item.)

Soumitra Sengupta’s SSDS at PDC 2008 post of 8/18/2008 describes the four SSDS presentations at PDC 2008:

  1. Microsoft SQL Server: Data-Driven Applications from Device to Cloud - Dave Campbell
  2. A Lap around SQL Server Data Services - Soumitra Sengupta
  3. Under the Hood: Building SQL Server Data Services - Istvan Cseri and Gopal Kakivaya
  4. SQL Server Data Services: Futures - Patric McElroy

Soumitra also recommends these related sessions:

  1. Microsoft Sync Framework: Enterprise Data in the Cloud and on Devices - Liam Cavanagh
  2. Microsoft Sync Framework Advances - Lev Novik
  3. Developing Applications Using Data Services - Mike Flasko
  4. Entity Framework Futures - Tim Mallalieu
  5. Project "Velocity": A First Look - Murali Krishnaprasad
  6. A Lap around Building Block Services - John Shewchuk
  7. Architecture of the Building Block Services - Dennis Pilarinos, John Shewchuk

 Werner Vogels, Amazon.com’s CTO, announced in his Expanding the Cloud post of 9/18/2008 that Amazon Web Services’ S3 service will be complemented by a new content delivery network (CDN) later this year. Amazon’s CDN will feature a “global network of edge locations this new service [that] can deliver popular data stored in Amazon S3 to customers around the globe through local access.”

While not competing directly with SSDS or other current Windows Live services, AWS’ expanded service repertoire indicates that Amazon plans to maintain its current #1 position in cloud computing. For more background and details, read Jeff Bar's post on the AWS weblog and Om Malik’s Amazon Launches Content Delivery Network. Rivals, Watch Out! article of 9/18/2008.

 Alex Iskold, founder/CEO of AdaptiveBlue, says (quoting an anonymous Amazon evangelist):

AWS now handles 50k requests per second from 400,000 developers. Bandwidth from AWS is now almost double the bandwidth of Amazon.com’s retail operations.

Niraj Nagrani has scheduled his TechNet Webcast: SQL Server Data Services Launch (Level 200) for 11/14/2008. See SQL Server Data Services to Launch On or Before 11/14/2008? of 9/18/2008 for a screen capture in case the SSDS folks change their mind on the “release,” which I think is the public beta.

Jeffrey Schwartz’s Reaching For The Clouds With SSDS Microsoft gives cloud-based repository lots of air play (excuse the pun) post of 9/15/2008 to the Redmond Developer New blog reviews Microsoft account architect Jim Williams’ SQL Server Data Services: An Introduction and Overview of Microsoft's Cloud Storage Service session about SSDS at VSLive! New York last week. Jeffrey’s article has a link to my SQL Server Data Services: Data storage in the cloud Tech Brief.

I’ve heard of building architects, software architects, and application architects but “account architect” is a new one for me. I wonder what pay grade Microsoft assigns to “account architects” and whether they have an industry association? Association of Account Architects? American Institute of Account Architects?

• Amitabh Srivastava, Microsoft VP of Cloud, Infrastructure, & Services, is interviewed on Channel9 for 9:02 about the cloud services sessions at PDC 2008. Here’s the deck:

In a very special edition, the VP of CIS, joins Mike and Jennifer to talk about what his team will be revealing at PDC (well, he can’t really say that much yet – you’ll just have to go to the PDC to find out his news).  An  11 year Microsoft veteran, Amitabh joined Microsoft in 1997 working in our Research group.  Now he works for Ray Ozzie, and the PDC is the coming out party for his team and what they’ve been working on in the Services space.

Much of the nine minutes was devoted to a discussion of utility computing (a la SSDS.)

• John Papa foresees cloud services as a major application for the next version of Silverlight in his Cloud Services are Important to Silverlight’s Future. John says:

I’m looking beyond this release a what might be in the next release. I think we’ll see a lot of graphical improvements, but where I see a great opportunity for growth is in the area of building more expansive cloud services support with Silverlight. Security, improved REST service interoperability, PUT, DELETE, increasing the HTTP stack, and other features that make working with cloud services would greatly enhance development in Silverlight and give it a big edge over competition. Who knows what [else] we’ll see, but from everything I hear from readers, there is a lot of interest in this area.

Roger Jennings wrote the SQL Server Data Services: Data storage in the cloud Tech Brief for the 9/15/2008 edition of Redmond Developer News. Click here to view the simple SSDS diagram.

For a deeper look into SSDS’s workings and updated test harness sample code, check out the fully illustrated Updated SQL Server Data Services (SSDS) Test Harness: Northwind REST and SOAP Uploads of 7/27/2008.

SQL Server Compact (SSCE) 3.5 and Sync Services

The Sync Framework Team announced v1.0 Service Pack 1 of Sync Services for ADO.NET on Devices (Windows Mobile) on 9/16/2008. This download lets you synchronize between a server database and a SQL Compact database on a Windows Mobile 5 or 6 device.

This announcement makes it more important than ever for SSDS to align with ADO.NET Data Services architecture in advance of the release of “Astoria Off-Line.”

Visual Studio 2008 Service Pack 1 (General)

No new posts as of 9/17/2008 9:30 AM PDT 

Miscellaneous (MVC, WPF, WCF, Silverlight, etc.)

Mike Taulty attempts in his Silverlight and WPF - Sharing Library Projects post of 9/21/2008 to create the following releases with common source code:

  • Desktop Debug
  • Desktop Release
  • Silverlight Debug
  • Silverlight Release

“but loading this project into Visual Studio looks to confuse Visual Studio.” Mike is looking for help from MSBuild gurus.

The Windows Live Writer Team has released an update to the WLW beta that appears more stable than the original WLW Wave 3 Technical Preview that I’ve been using the the past few weeks. The update is still a beta, but this version has received a very attractive visual upgrade.

Click here for the installer that lets you select the Live applications to install: Messenger v9, Windows Live Movie Maker, Mail with Calendar synchronisation, Writer, Photo Gallery, Family Safety and the Outlook Connector. You can’t deselect updates to the WLW and Live Mail betas.

Rob Connery finally finished his MVC Storefront Part 21: Order Manager and Personalization video segment on 9/16/2008. Rob says:

The first part is devoted to expanding the Order management pipeline bits - Charging, Shipping, and Cancellation. I expand on Windows Workflow and also create a separate code-based pipeline for those who don't want to use WWF. The second part is all about plugging in User Tracking and what it means to plant data that you can mine later.

Aaron Skonnard’s announces in his The "Endpoint" show on Channel9 post of 9/16/2008 that his WCF Endpoint screencasts have moved to Channel 9. Following are links to the four current episodes:

WCF and WF posts alternate in four-week cycles. The next WCF post is due

Dan Wahlin shows you how to use Silverlight 2 User Input Controls for data input in his “Wahlin on .NET” column for the September 2008 issue of Visual Studio Magazine.

Jeffrey Palermo is interviewed by Bob Familiar about Architectural Concerns for the ASP.NET MVC Framework at Tech*Ed 2008 Developer. Here’s the deck:

Join Jeffrey Palermo for a boots-on-the-ground talk about how to fit ASP.NET MVC into your Web application architecture while avoiding some of the pitfalls common with Web Forms. We'll cover the following in depth: designing for testability, loose coupling, separation of concerns, automated testing of controller actions, dependency injection, and leveraging IoC container support from the MvcContrib open source project.

2 comments:

Stephen Russell said...

Anyone else having a problem with Linq .EDMX designer not opening the 2nd page for making a new edmx file?

I cannot associate the db to the edmx. The GUI just vaporizes and new file is not created.

Roger Jennings (--rj) said...

@Stephen,

I haven't encountered the problem and I've been hitting the designer quite hard lately.

--rj