Showing posts with label ASP.NET 3.5 Extensions. Show all posts
Showing posts with label ASP.NET 3.5 Extensions. Show all posts

Friday, September 12, 2008

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

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

•••• Updated 9/14/2008 7:00 AM PDT: Addition of EF POCO v 1.02
••• Updated 9/12/2008 9:00 AM PDT: Additions to EF, LINQ, Astoria, SSDS, and Sync Services  
•• Updated 9/11/2008 2:00 PM PDT: Additions to EF, LINQ to SQL, LINQ (to NHibernate and XML), Misc. (Technorati, MVC) 
• Updated 9/10/2008 10:00 AM PDT: Additions to LINQ to SQL, Astoria, Dynamic Data, and SQL Server Compact

Note: All DevDays 2008 session links point to the MSDN Spotlight page because login with a Windows Live ID is required and links without a session ID fail.

Entity Framework and Entity Data Model (EF/EDM)

•••• Jarek Kowalski has updated his Persistence Ignorance (POCO) Adapter for Entity Framework V1 (see below) to v1.02 to fix three issues reported by users that his EF POCO Adapter updated (v1.02) post of 9/13/2008 describes. Download the updated code here.

••• Elisa Flasko’s PDC 2008 - Los Angeles, CA - Oct. 27-30 post of 9/12/2008 to the ADO.NET Team blog describes Tim Mallalieu’s Entity Framework Futures session at PDC 2008:

The next version of the Entity Framework adds scenarios in the areas of   model driven development, domain driven development, simplicity, and integration. See a preview of production and prototype code for the next version of the Entity Framework as well as a candid discussion with members of the development team.

In the meantime, EF V1 pilgrims are still awaiting the arrival of the promised minutes of the first EF Advisory Council meeting.

Alex James provides a detailed description of the plans for adding a domain-design-first feature to Entity Framework v2 in his Model First post of 9/10/2008. Topics include:

  • Generating Databases from Models (an overview of the process and UI)
  • Under the Hood (a description of the Sequential Workflow WF implementation)
  • Stage and Purpose (of each WF element)
  • Templates (the T4 templates that perform CSDL to SSDL, CSDL to MSL, and SSDL to DBSchema transformations)

Huageti Systems’ Kristofer Andersson notes in his Tools - Part 5 - Add-ins - Documentation features in Entity Framework vs Linq-to-SQL post of 9/2/2008:

[EF’s documentation feature] has a cosmetic flaw: In the haste to release VS2008 and .net 3.5 SP1 it seems like MSFT forgot to apply the entity type documentation to the entity set accessor properties, so entity sets (and all undocumented classes and properties) will show the default “There are no comments for [name] in the schema.“. I would like to see the EntitySet using the same documentation as the EntityType, or at least have a “Documentation” property of its own. (It does in the EDMX, but not in the designer)

The “There are no comments” default value is a bit redundant and waste of screen real-estate. Why not leave the default value blank? Oh well, this is just version one so I guess that will be improved in some future service pack update.

Also missing is the ability to automatically populate the documentation field with descriptions from data model diagrams and/or the database. The descriptions may already exist in a data model diagram or in the database. In addition, knowing what indexes exist is very useful when writing queries, and what indexes exist on tables etc are of course available from the database so being able to automatically retrieve those two pieces of information from the db would be a nice-to-have feature.

According to Alex, EF v2 will include metadata for indexes because the generated DDL add them.

Note that Damien Guard has produced an initial set of T4 templates for serializing LINQ to SQL classes, as described in my Bidirectional Serialization of LINQ to SQL Object Graphs with Damien Guard’s T4 Template in VS 2008 SP1 of 7/27/2004. A later version will add:

  • Inheritance support
  • VB.NET generation
  • DataContract serialization

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

Jarek Kowalski’s Persistence Ignorance (POCO) Adapter for Entity Framework V1 post of 9/9/2008 provides extensive details about the new EFPocoAdapter that’s available for download from the CodeGallery. Here’s its description:

EF POCO Adapter enables Plain Old CLR Objects (POCOs) to be tracked using released version of Entity Framework V1. It consist of a code generator, supporting library and a test suite and examples.

Code generator writes an adapter layer that will translate between POCO objects and Entity Framework-aware objects and provide services on top of POCO objects, such as:

  • Change tracking (snapshot-based and proxy-based when possible)
  • Transparent lazy loading
  • Immutable Value Objects
  • Queries (LINQ and Entity SQL)
  • Shadow state (maintaining certain persistence-related fields outside of entity class)

Entity Framework V1 programming interfaces are wrapped with corresponding APIs that work with POCO objects and do necessary translation between POCO and Persistence-Aware objects.

The availability of the new adapter should quiet the tumult and shouting about EF’s lack of persistence ignorance.

• Update 9/10/2008: From comments to Jarek’s post:

Roger Jennings (9/9/2008):

Does Astoria consider the POCO Adapter's EFPocoContext a first-class data source, that is, supports IQueryable<T> and induces the Astoria runtime to provide IUpdatable<T>?

In other words, can it be plugged into an Astoria project without adding a significant amount of code?

Jarek Kowalski (9/9/2008):

I'll investigate the Astoria question, but since EFPocoAdapter does not implement IUpdatable I don't think it works now. …

OK. I have played with Astoria and I was able to get a basic service to work. All you have to do is to derive from DataService<adapterContextType>, such as:

public class NorthwindEFService : DataService<NorthwindEntitiesAdapter>
{
}

This makes use of the "second face" of the object model, which is the EF-compatible adapter layer. Astoria doesn't have a clue that it is talking to POCO model, but the EF-POCO translation happens under the hood.

Implementation of IUpdatable should be pretty straightforward, though.

Mike Taulty presents Understanding the ADO.NET Entity Framework at DevDays 2008 Amsterdam (Video, May 2008).

LINQ to SQL

•• Mike Tulty’s Messing with Dynamic LINQ Queries post of 9/11/2008 shows his attempt with a LINQ to SQL query:

[T]o take the Expression which will have 2 parameters and reduce it down to an Expression which has 1 parameter by hard-wiring the 2nd parameter with the current value of the loop variable "s" into the method call expression itself as a constant.”

• Mike Hadlow has posted a working sample and source code for the Suteki Shop eCommerce application that uses the following technologies:

  • .NET 3.5
  • MVC Framework
  • LINQ to SQL
  • Windsor IoC Container
  • NUnit (for testing)
  • Moq (for mocking)

• Matt Manela explains in his SQL CE 3.5 with LINQ to SQL post of 9/9/2008 how to avoid the performance hit caused by moving SQL Server Compact (SSCE) 3.5 into and out of memory when LINQ to SQL opens and closes connections on single or multiple threads.

Bill BurrowsASP .NET MVC Framework - Preview 4 Update demonstration “highlights the changes in the MVC model since the release of Preview 1 and covers both "drill-down" applications as well as showing how to update and existing database record and add a new record” with VS 2008 (not SP1), LINQ to SQL and VB.

It’s unfortunate that the demo is one service pack and preview behind, but most of the two video links apply to current releases.

Bill also offers a VB-based LINQ to SQL Tutorial and Introduction to MVC Tutorial.

Anko Duizer presents Is LINQ to SQL your data Access Layer? from DevDays 2008 Amsterdam (Video, May 2008).

LINQ to Objects, LINQ to XML, et al.

••• Eric White describes how LINQ used C# 3.0’s closures feature in his Closures post of 9/12/2008.

•• Ayende Rahien‘s NHibernate 2.0 and Linq post of 9/11/2008 delivers formal notification that LINQ to NHibernate is not part of the recently-released NHibernate 2.0, but an improved LINQ implementation will be part of NHibernate 2.1.

However, he notes that “Daniel Guenter has back ported the current version of Linq to NHibernate to Nhibernate 2.0 and made it available here.”

Mike Hadlow noted problems with LINQ to NHibernate and complex queries in his What's up with Linq to NHibernate? post of 9/2/2008.

•• Shayne Burgess notes that the XML Team plans to incrementally publish “frequently encountered issues in System.XML; mainly points that we felt were interesting because they were the source of a lot of difficulty for our users.” The first two members of the Frequently Asked Questions on XML in .NET series are:

  1. Part 1: Invalid Literals (9/10/2008)
  2. Part 2: Conformance Level – Fragment (9/10/2008)

While not specifically about LINQ to XML issues, they should be of interest to developers using LINQ to XML.

John Papa describes a workaround for an Amazon Web Services’ book price ambiguity in his LINQ to XML Tip - Checking for Values post of 9/9/2008.

Eric White explains “how to use content controls in Open XML word documents to delineate code snippets so that you can automate validation of the snippets” in his OpenXmlCodeTester: Validating Code in Open XML Documents post of 9/8/2008. Eric says:

I suspect that this blog post will be very interesting to a very few people, but of casual note to all others. I’m very interested to hear if this scenario is useful to you. But more than this particular scenario, I want to spark interest in the possibilities that content controls open up for you.

This may be the longest blog post I’ve written, because this blog post also serves as a manual of sorts for OpenXmlCodeTester.

Eric’s code is based on functional programming principles and all variable values are immutable.

Sessions from DevDays 2008 Amsterdam (Video, May 2008):

ADO.NET Data Services (Astoria)

••• Elisa Flasko’s PDC 2008 - Los Angeles, CA - Oct. 27-30 post of 9/12/2008 to the ADO.NET Team blog describes the following two Astoria presentations at PDC 2008:

Developing Applications Using Data Services: Mike Flasko

In the near future, applications will be developed using a combination of custom application code and online building block services, including data-centric services. In this session we discuss advancements in the Microsoft development platform and online service interfaces to enable seamless interaction with data services both on-premises (e.g., ADO.NET Data Services Framework over on-premises SQL Server) and in the cloud (e.g., SQL Server Data Services). Learn how you can leverage existing know-how related to LINQ (Language Integrated Query), data access APIs, data-binding, and more when building applications using online data.

Offline-Enabled Data Services and Desktop Applications: Pablo Castro

The ADO.NET Data Services Framework (a.k.a. Project "Astoria") introduced a way of creating and consuming flexible, data-centric REST services. By combining data services with the Microsoft Sync Framework, learn how to create offline-capable applications that have a local replica of their data, how to synchronize that replica with an online data service when a network connection becomes available, and how replicas can be used with the ADO.NET Entity Framework. Also, hear us talk about our plans, see the tools that help client- and server-side setup, and discuss the runtime components and APIs.

Mike Flasko’s ADO.NET Data Services Concepts post of 9/9/2008 points to a new "Overview of ADO.NET Data Services" white paper on MSDN. Mike says:

The document is meant to cover the high-level concepts for the product.  A companion paper "Using ADO.NET Data Services" published a little while ago complements this overview with details on product features and how to use them. 

Coming up next is a paper which goes one level deeper and shows how to host data services in different environments (ASP.NET, WCF, IIS, WCF self host, etc).

Click here for more information from LINQ and Entity Framework Posts for 9/2/2008+ about the companion paper.

Sessions from DevDays 2008 Amsterdam (Video, May 2008):

ASP.NET Dynamic Data (DD)

•• Mike Ormond’s Dynamic Data and Entity Framework post of 9/11/2008 describes exceptions thrown when using EF with Northwind as the data source: one with the Order_Details entity and one when navigating the Product –> Order_Details relations (that composite index issue again!) The fix is the Dynamic Data Entity Framework Workaround on CodePlex.

Steve Naughton completes his Dynamic Data Futures series with his Dynamic Data Futures – Part 3 – AnyColumnAutocomplete Filter post of 9/9/2008. Steve says:

The issue is that the Autocomplete filter and AutocompleteFilter web service is designed to work with Foreign Key columns, I thought this would be like the previous article in this series and be quite simple, instead it turned out to be a bit more complicated

SQL Server Data Services (SSDS)

••• Eugenio Pace lauds Apprenda’s SaaSGrid cloud services framework for ISVs in his Northwind Hosting exists, it's better than what you saw and it's called SaaSGrid post of 9/12/2008. Eugenio says:

This "non-intrusiveness" of SaaSGrid is a property of PaaS offerings we have studied in the past. I personally believe that all offerings requiring an ISV to re-write an app, or re-learn a whole new development paradigm (custom language, non-mainstream storage, etc) will be at a disadvantage compared to PaaS offerings that will make the most of your existing investments and strengths, and therefore adoption will be hurt (probability +80% :-)).

Eugenio’s Northwind Hosting concept demo and related white papers form much of the foundation of SSDS and especially the LitwareHR demo. Watch the video to learn more about SSDS’s current and future architecture and features.

Mike Amundsen updated his “SSDS-Proxy and SSDS Provision Client code on 9/8/2008 to support returning the Authority List for the logged-in user. This update also includes support for reading and deleting BLOB files (no upload via the web - yet).”

A live demonstration is running here http://amundsen.com/ssds/. The source code is available from Codeplex http://codeplex.com/ssdsexamples/.

SQL Server Compact (SSCE) 3.5 and Sync Services

••• See Offline-Enabled Data Services and Desktop Applications: Pablo Castro

• Matt Manela explains in his SQL CE 3.5 with LINQ to SQL post of 9/9/2008 how to avoid the performance hit caused by moving SQL Server Compact (SSCE) 3.5 into and out of memory when LINQ to SQL opens and closes connections on single or multiple threads. (Also in LINQ to SQL category.)

Martijn Beenes presents Sync Framework from DevDays 2008 Amsterdam (Video, May 2008).

Visual Studio 2008 Service Pack 1 (General)

Beth Massi’s What's New in Visual Studio 2008 SP1 - Client and Data Features post of 9/11/2008 includes links to the slides and code from her presentation to the East Bay.NET UG on some of the new features in Visual Studio Service Pack 1, including:

  • SQL 2008 Types and Data Binding Support
  • ADO.NET Sync Services Enhancements
  • WPF Enhancements
  • ADO.NET Entity Framework Designer
  • ADO.NET Data Services (Astoria)
  • “Client Profile” Framework Deployment
  • VSTO Content Controls and Smart Tags
  • VSTO Deployment Improvements

I wonder how long the meeting lasted.

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

•• (OT) Roger Jennings takes Technorati to task for making acquisitions while failing to maintain their primary obligation to the blogosphere and provide timely customer service in his More Technorati Troubles post of 9/11/2008.

These two posts re Technorati were added on 9/12/2008:

Update 9/11/2008 2:30 PM PDT. Apparently the above post caught Technorati’s attention. The latest posts are now appearing and the Authority was updated (-2 points.)

David Hayden’s ASP.NET MVC and Enterprise Library Validation Application Block post of 9/10/2008 complements his earlier post with instructions for integrating the Validation Application Block with ASP.NET MVC.

Scott Heuer says in his 9/9/2008 post, H.264 and AAC support coming to Silverlight (in a future version). The Silverlight Shines at International Broadcasting Conference 2008 in Amsterdam press release of the same date includes Q&A with Scott Guthrie about the new video codecs for Silverlight.

Mike Taulty’s Silverlight, Async, Events post of 9/8/2008 deals with issues around asynchronous operations and the inability to pass an event into a function.

David Hayden uses a simple Customer class in his Custom Model Binder and More UI Validation in ASP.NET MVC post of 9/8/2008 to demonstrate the CustomModel binder’s input validation capabilities.

David Hayden’s ASP.NET MVC UI Error Handling - ModelState and AddModelError post of 9/7/2008 demonstrates validating a phone number input with ModelView’s ModelState property and the ModelState.AddModelError() method.

Miscellaneous Sessions from DevDays 2008 Amsterdam (Video, May 2008):

Saturday, June 14, 2008

ASP.NET Dynamic Data: Scaffold a Custom Administrative Web Site with a LINQ to SQL Data Model in Less than Five Minutes

This screen capture sequence illustrates the “Use the Wizard to Generate Custom Pages” topic of the Scaffold Web Apps with ASP.NET Dynamic Data cover story for the September 2008 issue of Visual Studio Magazine. The topic describes how to create a fully-functioning file-system Web site from the Northwind sample database.

Step 1: Launch Visual Studio 2008 or Web Developer Express SP1, start a new file-system Web site and select the Dynamic Data Website Wizard (Preview) template.

Step 2: Accept the Generate a New Data Model from This Database option and select a connection to an SQL Server instance with the Northwind sample database installed.

Step 3: Select the only the original Northwind tables to install; omit the Regions and Territories tables. (The May 23, 2008 Dynamic Data preview was limited to LINQ to SQL as the data model. If your version of this dialog has a Data Context Namespace text box, leave it empty.)

Step 4: Scaffold all eight EntitySets for your project with List, Details, Edit and Insert pages.

Step 5: Accept the default customization options. You can remove features that use DetailsView or FormView controls or elect to edit or insert pages inline with GridView or ListView controls.

Step 6: Click Edit to open the Edit Fields dialog. Clear columns for properties of the selected entity that you don’t want to appear in the GridView or ListView control. (This dialog was not fully cooked in the May 23, 2008 release on which this post is based.) Click OK and then click Finish.

 

Step 7: Generating the scaffolding code will add several files to existing project folders. Mark the Apply to All Items check box and click Yes to avoid repeated appearances of the Merge folders message box.

Step 8: Review and optionally rearrange the singularized EntityType widgets. Notice the addition of a prebuilt NorthwindDataContextPartialClass file and addition of a CustomPages subfolder for each EntitySet. (Click image for an 1024 x 768 screen capture.)

Step 9: Press F5 to build and run the project, clicking OK to dismiss the Debugging Not Enabled message box.

Step 10: Notice the insertion of the Web site name after the Domain:Port name and number for the default and other pages.

Step 11: Click Products to display the Products ListView. Notice that a column for ProductID is missing and that Category and Supplier columns are out of sequence when compared with the original sequence of entity properties. (Click image for an 1152 x 864 screen capture.)

Appearance After Formatting with CSS and Minor Heading Changes

Following are customized versions of the forms shown in steps 10 and 11 as well as a Supplier details page with 11-point Calibri substituted for the approximately 8.5-point (76%) default Tahoma and Trebuchet MS fonts as well as color saturation increased.

Figure 12: /DynamicDataWebSite/Default.aspx

Figure 13: /DynamicDataWebSite/Products/List.aspx (Click for 1172 x 864 pixel version). Notice that the DynamicFilter dropdown lists are missing from Wizard-generated ListView pages.

Figure 14: /DynamicDataWebSite/Suppliers/Details.aspx$SupplierID=1

Sample code for the project, which includes customization by manipulating table and field metadata, will be available when the article publishes.

ASP.NET Dynamic Data: Generate a Dynamic Administrative Web App from an Entity Data Model in Less than Five Minutes

This screen capture sequence illustrates the “Generate a Dynamic-Page Web App” topic of the Scaffold Web Apps with ASP.NET Dynamic Data cover story for the September 2008 issue of Visual Studio Magazine. The topic describes how to create a fully-functioning ASP.NET Web Application from the Northwind sample database.

Step 1. Launch Visual Studio 2008 or Web Developer Express SP1, and select the Dynamic Data Entities Web Application template to use an Entity Data Model as the data access layer (DAL) for your project. (The Dynamic Data Web Site file-system project uses LINQ to SQL as its DAL.)

Step 2: Add an ADO.NET Entity Data Model DAL and give the model a descriptive name.

Step 3: Accept the default Generate from Database option in the first Wizard dialog.

 

Step 4: Select a connection to an SQL Server 2005 or 2008 instance of the Northwind sample database. (The computer name appears when localhost\SQLEXPRESS is specified as the Data Source.)

 

Step 5: Select the eight tables from the original Access version of the database and click Finish.

Step 6: After a few seconds the Entity Framework’s graphic object/relational mapping (O/RM) designer appears with the Model browser in the right pane. Rearranging the entity widgets and singularizing EntityType names is optional. (Click the image to open a full-size (1024 x 756) capture.)

Step 7: Open the Global.asax settings file and change the model name to NorthwindModel.NorthwindEntities and change ScaffoldAllTables from false to true. (Click the image to open a full-size (1024 x 756) capture.)

Step 8: Press F5 to compile and run the Web app with the ASP.NET Development Server (Cassini). Click OK to enable debugging.

Step 9: This subdued page opens to display a DynamicGridView of EntitySets. (The UI designers appear to have forgotten that the data source is an ObjectContext for EntitySets, not a relational table, and possibly are color blind.)

Step 10: Click the Products link to open the Products EntitySet in a DynamicGridView with three DynamicFilters for display by Discontinued state, Category and Supplier. Clicking a Category or Supplier link opens a DynamicDetailsView; clicking Order_Details opens a DynamicGridView of all Order_Detail entities that include the selected Product.

The three dropdown lists above the grid are DynamicFilter controls that enable filtering by Discontinued (Boolean) status (All, true, false), Category, Supplier or any combination of the three.

(Click the image to open a full-size (1152 x 864) capture.)

Step 11: Click a supplier link, such as Exotic Liquids, to display a DetailsView of the Supplier entity.

Optional Step 12: Singularize EntityType and navigation property (endpoint) names to correspond with association multiplicity. (Click the image to open a full-size capture.)

Appearance After Formatting with CSS and Minor Heading Changes

Following are customized versions of the forms shown in steps 9, 10 and 11 with 11-point Calibri substituted for the approximately 8.5-point (76%) default Tahoma and Trebuchet MS fonts as well as color saturation increased.

Figure 13: Default.aspx

Figure 14: /Products/List.aspx (Click for 1172 x 864 pixel version)

Figure 15: /Suppliers/Details.aspx$SupplierID=1

Sample code for the project, which includes customization by manipulating table and field metadata, will be available when the article publishes.

Thursday, May 15, 2008

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

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

VS 2008 SP1/.NET 3.5 SP1 Beta-Related Posts

An Example of Updating an ADO.NET Data Services SP1 Beta Web Service and Client

My Updating Simple ADO.NET Data Services and Data Service Clients to SP1 Beta post of May 15 2008 details the process of updating a sample ADO.NET Data Services Project (client and server) from the last Astoria CTP and Entity Framework Beta 3 to the current VS 2008 SP1 Beta drop.

Added: 3/15/2008 4:00 PM

Updated ASP.NET Dynamic Data Samples for SP1 Beta

The MSDN Code Gallery's ASP.NET Dynamic Data Preview offers a May 12, 2008 release of the original Dynamic Data Samples. Here's a description of the samples (lightly edited):

  • DbImageAPI.zip contains a sample field template that shows how to display and add images from a database.
  • DoubleColumn.zip is an advanced example that shows how to display two columns from a database in one column in data bound control.
  • DynamicLabel.zip shows how the main control inside of a Dynamic Control can be exposed and in this case used as the AssociatedControlId of a Label control.
  • The ExistingWebsite.zip contains an example of using the Dynamic Data controls in an existing website. It contains both the old way and the new way of doing this and how much less code the new method uses.
  • Scaffold.zip just shows an empty web application with a database and a data model. Once run it will display the dynamically created scaffold that Dynamic Data generates.

You can use SP1 Beta's new ASP.NET Routing Engine (System.Web.Routing) with ASP.NET Dynamic Data SP1 Beta.

Added: 3/15/2008 10:50 AM

ASP.NET Dynamic Data SP1 Beta Help File Link

Individual topics are a bit difficult to find in the online help files, so here's the link to ASP.NET Dynamic Data Overview.

Added: 3/15/2008 10:30 AM

David Hayden Continues his ASP.NET Dynamic Data SP1 Beta Series

His March 15, 2008 Dynamic Data Websites - Displaying Tables and Columns using ScaffoldTable and ScaffoldColumn Attributes post shows you how to control scaffolding of specific tables or columns.

Links to earlier posts on ASP.NET Dynamic Data SP1 Beta series are in the "David Hayden Posts Walkthroughs for the ASP.NET EntityDataSource and Dynamic Data Scaffolding" topic of LINQ and Entity Framework Posts for 5/12/2008+

Added: 3/15/2008 10:30 AM

ADO.NET Team: SP1 Beta Breaking Changes to the Entity Framework

The ADO.NET team posted Entity Framework Breaking Changes - Visual Studio 2008 & .NET 3.5 SP1 Beta in the morning of May 14, 2008, but the link from another ADO.NET post was broken until larger in the afternoon. The changes fall into the following categories:

  • Schema Changes( covers CSDL, SSDL and ProviderManifest Xml formats)
  • Object Services Changes
  • Providers
  • Metadata

Ryan Hauert and David DeWinter Find EDM Designer Bugs in SP1 Beta

In his New Entity Framework designer bugs in SP1 beta of May 14, 2008, Ryan Hauert finds the following bug most frustrating:

The Error List window now lists fake errors for all of our subtypes that are children of abstract entities with a message similar to “Entity types B, C, D are mapped to table A without discriminating conditions on all mappings to the table.”

I reported similar, non-fatal "fake errors" from SQL Server Compact 3.5 SP1 data sources that disappeared on building the project in my Upgraded Northwind.sdf File for SSCE v3.5 Available for Download of May 8, 2008 (Updated May 11, 2008).

Ryan reports he found another bug that "relates to result column bindings for mapped sprocs on subtypes." He includes links to the ADO.NET Entity Framework and LINQ to Entities (Pre-release) forum and Microsoft Connect for the two bugs. VS 2008 SP1 Beta has its own forum here.

Danny Simmons Offers Links to SP1 Help Files, FAQ, and Breaking Changes

Danny's A little more about SP1 Beta and the EF post of May 14, 2008 includes links to online help files for:

Neither Danny or I were able to search these files. I tried LiveSearch and Google without success.

He's also upgraded his FAQ to SP1 at Updated Entity Framework FAQ.

Diego Vega Describes How to Add the Missing LinqDataSource to SP1 Beta's Toolbox

His May 14, 2008 Can't find the Entity Data Source? post gives the step-by-step instructions for adding the LinqDataSource component to the Web forms toolbox and, if necessary add the assembly manually.

The ADO.NET Team Admits There's Little New in LINQ to SQL

The What's New in the SP1 Beta for LINQ to SQL? describes these new features:

Across the LINQ to SQL we have made numerous bug fixes, better SQL translation for queries comparing nullable columns in Visual Basic, and support both in the runtime and the designer for SQL Server 2008.

New SQL Server 2008 Support includes:

  • Support for connecting to SQL Server 2008 databases in Server Explorer
  • Drag & drop tables in SQL Server 2008 databases from Server Explorer
  • Support for the following new types: Date, Time, DateTime2, DateTimeOffset, Filestream

Apparently, LINQ to SQL doesn't plan to take advantage of the upgraded DataContractSerializer that can handle EntitySets and EntityRef for associated entities in a entity.

Diego Vega Provides Some History and Explains Why the EntityDataSource Wraps the Data-Bound Entity

Julie Lerman posted Thinking about the EntityDataSource on January 22, 2008 with the goal of preventing issues with the LinqDataSource being repeated in the EntityDataSource. Diego's New EntityDataSource Control for ASP.NET post of May 13, 2008 attempts to answer at least part of Julie's issues.

The EntityDataSource already is raising questions in the forums. In the EntityDataSource: To wrap or not to wrap of the same date, Diego explains the reasons and rules for wrapping entities instead of exposing them directly.

ADO.NET Entity Framework & LINQ to Relational Data MSDN Code Gallery Site Updated

The ADO.NET Team's UPDATED WIKI: Home link points to the location of updated EFExtensions, eSQLBlast and Entity Framework Query Samples, as well as new Entity Framework Lazy Loading and EFMappingHelper releases.

Diego Vega's ADO.NET Entity Framework Query Samples post of May 13, 2008 points to a "release[, which] contains query samples that are compatible with the .NET 3.5 SP1 Beta version of Entity Framework."

Other LINQ and Entity Framework Topics

Mike Taulty Releases a Two Seasons of Silverlight 2 Beta 1 Screencasts

Mike lists the topics of his 50 New Silverlight 2 Beta 1 Screencasts in this May 15, 2008 post. If his segments were a network weekly, he'd have two years (seasons) in the can.

Here are six segments related to data binding, LINQ to XML, and the DataGrid:

  • 13. Simple Data Binding of UI to .NET Classes
  • 14. List Based Data Binding
  • 15. Data Binding UI to .NET Classes with Converters
  • 39. Reading/Writing XML with LINQ to XML
  • 49. Getting Started with the DataGrid
  • 50. Insert, Update, Delete with the DataGrid

You can download a Silverlight 2 app with a clickable listbox of segments. The selected item comes from Microsoft's free Silverlight Streaming service.

Added: 3/15/2008 10:30 AM

LINQ to SharePoint Competitor INQ4SP in the Works

SharePoint developer Agnes Molnar has developed a competitor to Bart De Smet's LINQ to SharePoint implementation. Following are her three posts that describe LINQ4SP:

Bart appears to have abandoned support for LINQ to SharePoint after going to work for Microsoft.

P.S. OBA is an abbreviation of Microsoft Office Business Applications.

Jonathan Aneja Covers LINQ to DataSet's AsEnumerable() Method

Jonathan's post of May 14, 2008, How LINQ to Dataset works in VB (Jonathan Aneja), describes how the VB compiler handles DataTables with the System.Data.DataSetExtensions' AsEnumerable() method.  Using LINQ to Dataset in an .aspx page (Jonathan Aneja) of May 13, 2004 describes why Imports System.Data is required rather than Imports System.Data.DataSetExtensions.

Dan Whalin Solves the Problem with Timestamp Data in GridView Controls

His Working with the GridView and the System.Data.Linq.Binary Type post of May 14. 2008 coerces the timestamp column to the Binary data type to prevent exceptions during serialization. Dan says:

When I tried to get the serialized TimeStamp data back into the RowVersion property of the LINQ to SQL object (which is the Binary type I mentioned earlier) I kept getting a conversion error initially.  I tried several different options such as the Convert class, converting character arrays to byte arrays, etc. but nothing worked at first.  The main problem was that I was trying to convert the data held in key.Values[1] object to a String type and then convert that back to the Binary type.  After playing around with it more I tried the super simple way of converting the data.  I cast the serialized value directly to the Binary type which was much easier than I was expecting.

John Papa's Writing Data Access with Silverlight 2 for O'Reilly

In As it Once Was, I am Writing a Book of May 14, 2008, John Papa announced that he's back to writing books again and expects O'Reilly will publish Data Access with Silverlight 2 in November or December 2008.

LINQ to MPI.NET Is Nearing Release with a Multithreaded Scoping Model

After months of silence, Adam Sobieski 's Update: LINQ for MPI.NET post of May 14, 2008 announces that Phoster Incorporated's LINQ for MPI.NET implementation now has a multithreaded scoping model. The announcement says the new feature:

[S]implifies the utilization of distributed objects which can utilize the calling MPI communicator context while utilizing .NET interfaces such as ICollection. Before developing this multithreaded scoping model, many of the methods of the distributed data objects had a communicator as a first parameter.

For more information about MPI.NET and LINQ to MPI.NET, read the "LINQ to MPI.NET in Development at Phoster Incorporated" topic of Link and Entity Framework Posts for 11/19/2007+.

Derek Whittaker Finds LINQ to XML Three Times Faster than XPath to Find a Unique Value in a 5.25 MB Document

Derek continues his comparisons of LINQ to XML and XPath with these three posts:

In his last post, Derek determines LINQ to XML is three times faster to XPath to find a unique value in a 5.25-MB document. Unfortunately, Derek didn't provide the code he used for the search.

Colin Meek Describes the SP1 Changes in the Updated EF Extensions Library

Colin's Using LINQ Expressions to Generate Dynamic Methods II of May 13, 2008 says:

The EF Extensions library has been updated to work with the beta and includes several public and internal changes. Source code is available at http://code.msdn.com/EFExtensions. The latest release introduces some performance improvements in the materializer (you can read about the library here). These improvements illustrate another powerful expression pattern.

To improve code clarity, the EF Extensions API encourages you to write:

var products = command.Materialize<Product>(r => new Product {
    ProductID = r.Field<int>("ProductID"),
    Name = r.Field<string>("Name"),
    }).ToList();

instead of a more complex (but faster) expression. Colin goes on to describe optimizations for the materializer.

Steve Lasker Announces SQL Server Compact 3.5 SP1 Beta Availability and Encryption Options

In his SQL Server Compact 3.5 SP1 Beta available announcement, Steve notes that SSCE 3.5 SP1 Beta is included in VS 2008 SP1 Beta, but the independent version lets VS 2005 users take advantage of the update.

Steve's Security and Encryption for SQL Server Compact describes the use of Encrypting File System and native SSCE password-based encryption to protect confidential data.

Rob Conery Refactors the MVC Storefront's Shopping Cart and Adds an Authorization Feature

His MVC Storefront, Part 10: Shopping Cart Refactoring and Membership post of May 14, 2008 begs for reader feedback.

Sunday, January 20, 2008

LINQ and Entity Framework Posts for 1/14/2008+

Danny Simmons Describes a Serializable EntityBag for n-Tier Entity Framework Deployment

I'm glad to see the ADO.NET Entity Framework team taking the pragmatic approach to Web service-enabling v1.0 with the serializable EntiyBag that Danny describes in his EntityBag Part I – Goals post of January 20, 2008.

For my take on Danny's answer to the LINQ to SQL Team's apparently-abandoned serializable "mini-connectionless DataContext" read Coming to the Entity Framework: A Serializable EntityBag for n-Tier Deployment, which ran too long for inclusion in this post.

Added: 1/20/2008

John Papa Explains How to Design an Entity Data Model with the EDM Tools

John's February 2008 "DataPoints" column for MSDN Magazine is subtitled "Designing an Entity Data Model." Topics include:

  • Understanding the EDM
  • Building an EDM with the Wizard
  • Stored Procedures in the Entity Model
  • Windows on EDM
  • Derived Entities

This article follows up his July 2007 "ADO.NET Entity Framework Overview" column.

Added: 1/20/2008

Eric White Explains How to Extract Comments from OOXML Documents

In his How to Extract Comments from Open XML Documents of January 16, 2008, Eric uses LINQ to XML to identify and extract comments as an XML list from WordprocessingML, SpreadsheetML, and PresentationML documents in a specified folder.

Added: 1/20/2008

Danny Simmons Posts the Finale to His Extension Methods Extravaganza

Danny's final post in the series, EF Extension Methods Extravaganza Part III – Fun with LINQ to Objects of January 17, 2008, includes the following LINQ to Objects extension methods that you invoke on an ObjectContext instance:

  • ObjectContext.GetEntities(EntityState state)
  • ObjectContext.GetRelationships(EntityState state)
  • ObjectContext.GetUnchangedManyToManyRelationships()
  • ObjectContext.GetRelationshipForKey(EntityKey key, EntityState state)
  • ObjectContext.GetRelationshipsByRelatedEnd(Entity entity, EntityState state)

He incorporates a caveat that these extension methods operate on internal methods that are subject to change in CTP and RTM releases that might be exposed in future releases, which potentially would obsolete some of these extension methods. (See Danny's comment of 1/18/2008.)

Added: 1/17/2008 Updated: 1/20/2008

Mike Taulty Produces Five ADO.NET Data Services Screencasts

His ADO.NET Data Services - Screencasts post of January 17, 2008 offers links to the following five video screencasts:

The "A Basic Silverlight Client" is a fast-paced, 14-minute segment that shows you how to create a simple read-only Silverlight Web client with WebDataGen.exe that's indistinguishable from the Windows version. Mike says:

I particularly enjoyed the Silverlight one which I stayed up into the small hours of the morning making. Why? Because of how closely it lines up with what you do in a full .NET application.

Once Silverlight grows some controls and databinding in version 2.0 I really see Silverlight+Data Services as being a killer combination.

Added: 1/17/2008

Rob Conery Continues the Subsonic 2.1 ("Pakala") Preview

Rob's SubSonic: 2.1 (Pakala) Preview, Part 2 post of January 16, 2008 shows an example of his Query2 syntax, which has decided LINQ overtones:

ProductCollection p = Northwind.DB.Select()
        .From<Northwind.Product>()
        .InnerJoin<Northwind.Category>()
        .Where(“CategoryName”).Like(“c%”)
        .ExecuteAsCollection<Northwind.ProductCollection>();

He also provides examples of code to return typed results from stored procedures and to substitute a new Repository pattern for the traditional ActiveRecord pattern.

Note: Pakala Village is on the Island of Kauai diagonally opposite Princeville, where Rob appears to live (on Weke Road, Hanalei).

Matt Warren Resurfaces with Part IX of the Building an IQueryable Provider Series

After a three-month hiatus, Matt finally posted LINQ: Building an IQueryable Provider - Part IX on January 16, 2008. (Matt blames the TV writer strike for the long delay.)

This post, which appears to be subtitled "Cleaning up the Mess," shows prospective LINQ IQueryable providers how to eliminate SELECT statement redundancy in generated SQL statements and eliminate unused columns from the query.

Be sure to read Frans Bouma's comment. He wants an episode that explains 'Funcletization' (and so do I.)

Note: Frans' Developing Linq to LLBLGen Pro, part 11 post (see the "Frans Bouma Tackles All/Any, Cast, and Contains but Abandons Aggregate and Concat" topic below) and Luke Hoban's response to a MSDN C# forum question are the only two Google hits I get on 'Funcletization':

What you describe is actually a generally useful thing to do for Expression Trees. We refer to it internally as "Funcletization" - though the name leaves something to be desired. Linq to SQL does something similar down in it's guts - turning sub-expression-trees which do not depend on any of the parameters into Constant nodes.

You can implement this yourself by:

1) Writing a visitor over the Expression Tree which recreates the tree at each node.

2) Specializing this to check at each node whether the subtree depends on any of the parameters, and if not - call .Compile on it and replace the sub tree with a Constant node with the value returned from calling the delegate returned from .Compile()

I've been meaning to post some sample code that does this - but maybe you can beat me to it :-)

Luke Hoban, who's a F#C# compiler PM, is probably the man to ask about Funcletization, but he appears to be blogging primarily (and infrequently) about functional programming.

Added: 1/17/2008 Updated: 1/20/2008

Danny Simmons Follows Up with EF Extension Methods Extravaganza Part II

The second episode, EF Extension Methods Extravaganza part II – Relationship Entry & IRelatedEnd of January 16, 2008, provides extension methods for querying relationship entries, EntityReference<T> and EntityCollection<T>. You're likely to find the following extension methods especially useful if the ADO.NET team doesn't provide the option to make foreign key values visible:

  • ObjectStateEntry.IsRelationshipForKey(EntityKey key)
  • ObjectStateEntry.OtherEndKey(EntityKey thisEndKey)
  • ObjectStateEntry.OtherEndRole(EntityKey thisEndKey)
  • IRelatedEnd.IsEntityReference()
  • IRelatedEnd.GetEntityKey()
  • IRelatedEnd.SetEntityKey(EntityKey key)
  • IRelatedEnd.Contains(EntityKey key)

Something to think about: All primary keys aren't necessarily surrogate keys; often it's a natural key that has business meaning, such as an employee ID number. Unless natural foreign key values are visible, you must instantiate the parent object to gain access to the value.

If part II is a harbinger, this looks to be a fast-paced series.

Added: 1/17/2008

Danny Simmons Launches Entity Framework Extension Methods Extravaganza

Danny's first episode, EF Extension Method Extravaganza Part I - ObjectStateEntry, of January 15, 2008 is "the first installment in a series of posts with lots of little extension methods which seem to make my recent Entity Framework experiments easier to write."

The first set of extension methods are:

  • GetEntityState()
  • ObjectStateEntry.UsableValues()
  • ObjectStateEntry.EdmType()
  • AssociationType.IsManyToMany()

This has the makings of an interesting series of posts.

Added: 1/16/2008

Marcelo Lopez Ruiz Explains ADO.NET Data Services' Built-In $filter Operators and Functions

Marcelo's Arithmetic and built-in functions for $filter include details about ADO.NET Data Services'

  • add (+)
  • sub (-)
  • div (/)
  • mul (*)
  • mod (%)

operators, as well as

  • String
  • DateTime
  • Math
  • Type

functions. The December 2007 "Using ADO.NET Data Services ('Project Astoria')" white paper for CTP1 also has descriptions and examples of these operators and functions.

Added: 1/16/2008

The Pfx Team Describes PLINQ's Debugger Display

The Debugger display of PLINQ queries of January 15, 2008 shows you how to get the most out of PLINQ's debugger with illustrations of the debugger display and debugger tips for simple parallel queries.

If you didn't follow early Parallel Programming with .NET posts about PLINQ, they started with little or no fanfare on November 29, 2007. Filter the posts on the PLINQ topic to see all seven related posts to date.

Added: 1/16/2008

David Hayden Delivers Illustrated ASP.NET Dynamic Data Images from Databases Demo

David's ASP.NET Dynamic Data - Displaying, Inserting and Editing Images in SQL Server Database post of January 15, 2008 says the following about Scott Hunter's Sample for Displaying Images from the Database using Dynamic Data post of January 14, 2008:

Scott's example shows off a number of really cool features and techniques:

  • Authoring Custom Dynamic Data Fields: DbImage.ascx, DbImage_Edit.ascx, and FileImage.ascx.
  • Using a Custom Attribute, ImageFormat, that contains format metadata.
  • Creating a Custom HttpHandler, ImageHandler.ashx, for displaying images from the database.
  • Generating a LINQ query on the fly, via LinqImageHelper, to get the image using LINQ To SQL.
  • Working with various Metadata and Reflection Classes in ASP.NET Dynamic Data and the .NET Framework.

His post also notes that "[t]here are numerous helper classes in a separate project that consist of the ImageFormat Attribute, ImageHandler HTTP Handler, LINQImageHelper for generating a LINQ To SQL query to get the image, etc."

See the "Scott Hunter Demos ASP.NET Dynamic Data Displaying Images from a Database" topic below for more details.

Added: 1/16/2008

Mike Taulty Continues His Reflections on Access Control for ADO.NET Data Services

His ADO.NET Data Services - More Sketchy Thoughts on Access Control post of January 15, 2008 proposes a ServiceAuthorizationManager implementation to "determine who it is that's calling my service and whether I allow them to do it based on a role."

Added: 1/16/2008

Michael Sync Demos a Databound Silverlight ListView

Michael's Consuming ADO.NET Data Service (Astoria) from Silverlight post of January 15, 2008 shows you how to how to access the ADO.NET Data Service (Astoria) from Silverlight with the  ADO.NET Data Services Silverlight Add-On. Michael says:

This article is just an introduction of how to use Astoria in Silverlight application. The sample that I used in this article is nearly as same as the sample which is mentioned in ASP.NET 3.5 Extensions Preview (Quick Start). But I used the Astoria Silverlight Addon and create the Silverlight listview that looks cool.

Thanks to Andy Conrad for the heads-up.

Added: 1/16/2008

Alex James Explains How to Perform Bulk Updates with LINQ to Entities: Part 2

From LINQ and Entity Framework Posts for 12/3/2007+:

Entity SQL v.1.0 doesn't include DML keywords, so you must use LINQ to Entities if you want to insert, update, or delete entities rather than operate on physical rows in the persistence store (a.k.a. database) directly. To update or delete entities, you must bring the entities into memory with the appropriate LINQ query before you modify or destroy them. Alex contends that this process "seems somewhat wasteful considering you could do this in T-SQL with one very simple update statement, thereby bypassing all the query, hydration and cross process shipping costs" when performing a batch update or deletion.

His previous post of December 7, 2007, Rolling your own SQL Update on-top of the Entity Framework - Part 1, showed about a third of the process for creating a generic Update<T>() function with the following signature:

public static int Update<T>(this IQueryable<T> queryable,  
       Expression<Func<T, T>> updator) where T : EntityObject 
{ 
    SqlDmlCommandFactory<T> factory = new SqlDmlCommandFactory<T>(queryable); 
    SqlCommand updateCmd = factory.GetUpdateCommand(updator); 
    return updateCmd.ExecuteNonQuery(); 
}

It's taken Alex more than a month to deliver Rolling your own SQL Update on top of the Entity Framework - Part 2 post of January 15, 2008, which describes creating the constructor for SqlDmlCommandFactory and its SqlDmlContext object, which also can provide the foundation for bulk deletion and insertion operations.

Alex's next post will cover the GetUpdateCommand() method. Hopefully, it won't take another month to deliver it.

Added: 1/16/2008

Frans Bouma Tackles All/Any, Cast, and Contains but Abandons Aggregate and Concat

Frans is nearing nearing completion of his LINQ to LLBLGen Pro implementation after having completed work on "all major parts of a SELECT query," including GroupJoin, GroupBy, and the aggregate functions.

In his Developing Linq to LLBLGen Pro, part 11 of January 15, 2008, he starts working on the remaining Standard Query Operators (SQOs) in alphabetical order.

Aggregate: Frans abandons his attempt to implement the VB-only Aggregate keyword because it won't compile in C# 3.0. Probably not a good idea, Frans. My LINQ to XML: Grouping and Aggregation Gotchas, Part II post of the same day has several examples of its use in conjunction with LINQ to XML documents created with VB's XML literal data type.

Update 1/20/2008: See Frans' comment of 1/18/2008 and my reply of 1/20/2008 regarding the Aggregate keyword.

All / Any: All() and Any() inside a Where clause will be supported. However, use without parameters as the final methods in the query won't be.

Cast: Enables compiling queries that otherwise would fail from missing types or type conflicts.

Concat: Frans abandons Concat because LLBLGen doesn't support UNION queries.

Contains: Contains proved difficult because it's schizophrenic: It can be "Queryable.Contains, IList.Contains, String.Contains, EntityCollection.Contains, etc." as Frans demonstrates with 12 sample queries. Contains is critical because it implements the IN () predicate, inter alia.

Frans clearly is on the home stretch and I'm looking forward to test-driving LINQ to LLBLGen Pro when it's done.

LINQ to XML: Grouping and Aggregation Gotchas, Part II

This is the promised sequel to my LINQ to XML: Grouping and Aggregation Gotchas, Part I post of January 7, 2008 which contains a single, large XML Infoset that demonstrates aggregation over business documents (such as sales orders or invoices) with rollups by customer, as well as grand totals for the document as a whole.

Rob Conery Describes Subsonic's Forthcoming MVC Implementation ("Makai")

Rob's SubSonic And MVC: Introducing Makai post of January 14, 2008 describes his vision and implementation of SubSonic's Scaffold control as a controller to provide a "complete editing suite with no tools to manage." Rob illustrates each current stock page template.

Subsonic "Makai" looks very similar to ASP.NET Dynamic Data and also resembles Blinq, but its editor includes the jQuery JavaScript library and a Membership controller is included. 

Scott Hunter Demos ASP.NET Dynamic Data Displaying Images from a Database

Scott's Sample for Displaying Images from the Database using Dynamic Data post of January 14, 2008 offers:

[A] sample project that shows some custom field template controls for Dynamic Data that allow images to be viewed/edited from a database. The sample also shows how you can view images that have their filenames in the database but the images on the physical disk. You can download the sample by clicking this download link: DOWNLOAD SAMPLE.

His post explains how to add the same functionality to your own Dynamic Data project.

LINQ to Google (GLinq) Surfaces on Source Forge

The latest third-party LINQ provider appears to be the Beta 1 version of Scott Brown's LINQ to Google (GLinq) that became available for download on December 3, 2007. According to Scott:

LINQ to Google allows developers to easily query Google's Data Sources using a strongly typed syntax. LINQ to Google shows an example of implementing IQueryable and IQueryProvider.

GLinq is an implimentation of the LINQ deferred execution model for querying Google's data sources. The initial release can be used to query the Google Base. Subsequent releases will target support for YouTube, Calendar, Email, etc. The ultimate goal of this project is to create a generic enough model to allow plugin providers for any REST API.

I will be adding posts in the near future on how the code works. For now you have to play with it yourself.

The source code carries a Common Development and Distribution License (CDDL)Common Development and Distribution License (CDDL).

Note: Don't confuse LINQ to Google with Luis Diego Fallas' LINQ to Google Desktop

Monday, December 10, 2007

ASP.NET 3.5 Extensions Preview Released

Updated 2/13/2008: See the "Data Services (Astoria Project)" topic.

Scott Guthrie announced Sunday night in his ASP.NET 3.5 Extensions CTP Preview Released post that the extensions finally were available for download as a compact 3.64 MB ASPNetExt.exe file.

Installation took a minute or two on my "real" Windows vista test machine but about three minutes on a virtual Vista instance. This is the first time I've encountered an "Installation is taking longer than expected" message from an installer.

Update 12/11/2007: Setup adds Microsoft.Data.Web.dll, Microsoft.Data.Web.Design.dll, Microsoft.Data.WebClient.dll, System.Web.Extensions.dll, and System.Web.Extensions.Design.dll to the /Program Files/Reference Assemblies/Microsoft/Framework/ASP.NET 3.5 Extensions folder.

Dynamic Data Support samples and the Microsoft AJAX Library install to a new \Program Files\Microsoft ASP.NET 3.5 Extensions folder.

Here are links to the online Readme.htm file and QuickStart documentation.

As mentioned in yesterday's update to the "Scott Guthrie: ASP.NET 3.5 Extensions Due on Sunday" topic of LINQ and Entity Framework Posts for 12/3/2007+, all five pieces of the preview are included in the installation:

  • ASP.NET Model-View-Controller (MVC) Add-in
  • ASP.NET AJAX Improvements
  • ASP.NET Dynamic Data Support
  • ASP.NET Silverlight Support
  • ADO.NET Data Services (Astoria) without the Silverlight client

Dynamic Data Support

Dynamic Data scaffolding uses LINQ to SQL as its object/relational mapper (O/RM), LinqDataSource v3.6 as the site's data source and new DynamicGridView and DynamicDetailsView controls.

David Ebbo's Introducing the new Dynamic Data post gives a synopsis of the process for generating and customizing Dynamic Data pages.

Here's a screen capture of the very subdued page for the Northwind Products table:

Click above capture for a full-size (1024 x 768) image.

The scaffolding enables creating a standardized set of Web forms with built-in navigation that's similar to the earlier (and now discontinued) Blinq project. Using LINQ to SQL as the O/RM limits v1.0 Dynamic Data sites to SQL Server as the RDBMS. David Ebbo says that support for LINQ to Entities will arrive in the future.

The question here is: "What happened to the SubSonic-based "convention-driven" scaffolding?"

Update 12/11/2007: The answer from Rob Conerly is in this comment to this post:

>>The question here is: "What happened to the SubSonic-based "convention-driven" scaffolding?"<<

It's coming :). Just need a week or 2 here.

Model-View-Controller (MVC) Add-in

Rob Conery, SubSonic's architect and primary developer, who's been working on the MVC UI Helpers (MVC Toolkit) for the last month, has posted two very detailed posts about MVC:

ASP.NET MVC: Using RESTful Architecture of December 6, 2007 shows you how to "architect your MVC application using a RESTful approach, and also how you can partition out your 'logical bits' so you DRY (don’t repeat yourself)."

ASP.NET MVC Preview: Using The MVC UI Helpers of December 5, 2007 explains how these helper methods "encapsulate UI code in the same way that Server Controls do with Web Forms."

Note: The MVC Toolkit is a separate download that includes Dynamic Data for MVC projects and the code for Rob's MVC UI Helpers post. Get the toolkit here as an MVCToolkit.zip archive.

Data Services (Project Astoria)

The ADO.NET team's Mike Flasko lists the new and upgraded ASP.NET Data Services features in his ADO.NET Data Services ("Project Astoria") CTP is Released post.

The Creating ADO.NET Data Services QuickStart instructions for ASP.NET Data Services show you how to get an Entity Framework-based data service up and running.

Note: There is a typo and an error in the QuickStart instructions for the "Create the Data Service" topic.

  • In "When the Add New Item window appears, select SimpleDataService," replace SimpleDataService with ADO.NET Data Service.
  • The following instruction doesn't work for VB services. "In this example, the database was called Northwind so the namespace is NorthwindModel," you must replace NorthwindModel with SimpleDataService.NorthwindModel in the Imports statement to make NorthwindModel visible.
  • The VB version then fails with an "The member with identity 'NorthwindModel.Categories' does not exist in the MetadataCollection" error message written to Default.aspx.

Update 2/13/2008: See the Fix for "Known Bug" when Creating ADO.NET Data Services with Visual Basic and a Web Application post for the workaroud to the last problem. There are a few other VB-specific problems under submission to the ADO.NET Data Services (Pre-Release) Forum.

Following is the default Atom 1.0 list of tables from the C# version of the QuickStart example:

And here's a capture of the first item of the Products collection:

Click above capture for a full-size image.

Notice that many:1 related entities have a type=entry and 1:many child collections have a type=feed. Services that return type=feed trigger IE 7's Feed template; you can read query output by a Page | View Source command.

Update 12/12/2007: Alternatively, open IE's Tools | Internet Options | Content tab, click Settings in the Feeds section and uncheck the Turn on Feed Reading View option.

Here's the source for the first two members of the Order_Details collections:

Update 12/11/2007: Andy Conrad, Astoria technical lead, shows you in his LINQ to REST post how to create a data service with LINQ to SQL as the data source and query it with LINQ query expressions translated to URI syntax.

Stay tuned for more about ASP.NET Data Services.