New ASP.NET Dynamic Data Controls : Nifty, But Not Real World
Today at MIX, a new set of controls aimed at simplifying data binding in ASP.NET were announced as part of the ASP.NET Futures release. The goal of these controls is to make the process of creating a data bound web site extremely easy. The theme of the presentation seemed to be "Use these controls to rapidly develop a starting point that you can replace portions of over time." While the controls do meet this goal, there is, in my opinion, only a very small set of real world projects that would ever use them.
Some of you roll your eyes when I voice my skepticism for the magical wizardry that Visual Studio and some controls (Web or Winform) offer to make data access and display too easy and impractical for real world enterprise applications. I can usually support my position in a debate, though I many times I'm satisfied to say "it just doesn't feel right." With these new Dynamic Data Controls, though, I think we'll all be able to agree: They're just not practical for most enterprise situations.
Let's review the offering before making a full judgement, though.
The story of the Dynamic Data Controls starts by adding a data source (currently only a SQL Server database) to the App_Data folder of your web site. (You may also be able to simply select a connection string, but it wasn't clear.) Then you create a web page, optionally using the pre-built Dynamic Data Web Form template. Finally, you add one or more of the new Dynamic Data Controls and there you have it. The magic behind the curtain recognizes the columns, data types, foreign key constraints and other info about your database and wires up a fully functional read/write data driven web site. You can even skip adding the web page and with a simple tweak of the web config you can have the auto.axd mechanism create an entire site for your database.
The new release offers several new controls. The DynamicList is essentially a grid with your typical edit, delete, and row select features. DynamicDetails and DynamicInsert controls gives you a details view and the ability to insert a record. The DynamicFilter is a drop down list or radio button (or maybe another control) that filters your data source. The DynamicRSS control exposes your data as an RSS feed. Finally, there is the big daddy DynamicAutoData control that is a composite of all of the above.
All of the controls support the extender pattern of setting the ControlID property to the ID of the Control you want to use. For example, if you want to make a DynamicFilter a DropDownList with so you can handle it's events, you would set the DynamicFilter's ControlID to the ID of the DropDownList.
<asp:DynamicFilter ID="dfOrderID" ControlID="ddlOrderID"/>
<asp:DropDownList ID="ddlOrderID" SelectedIndexChanged="ddlOrderID_SelectedIndexChanged"/>
So to review, with zero code, you created a data driven web site. You can even customize some of the style and behavior. But that's it. You haven't built an enterprise LOB application. And you really can't. The meat is in the magic, and there is a little too much mystery meat for my taste. Where's the security? Where are the business rules?
Unfortunately, there is no good answer, at least not yet. The roadmap for the Dynamic Data Controls seems to revolve around the use of LINQ as the data layer and that is where you would wire up your business logic. But integration with LINQ isn't ready.
I credit the team that built the Dynamic Data Controls for creating a neat tool. But unfortuantely (at least for now) outside of a purely internal or administrative web site, I don't see there being any enterprise-level value. Oh, and the whole thing just doesn't feel right.