This past Friday's ASP.NET MVP Chat was very good, a lot of participation by well known experts. I learned a lot just sticking around reading both the experts' answers and the side banter.
Anyway, one issue that has been bugging me is whether to use declarative data binding in ASP.NET 2.0. So I asked Scott Guthrie if it was really a prime time thing or just something to "give good demo." He and Scott Mitchell both suggested it's the way to go, so I poked around and found the following:
ASP.NET 2.0 Data Tutorials
Peter Kellner's SQLDataSource Comments
Brendan Tompkins ObjectDataSource/GridView Experience
DataTableAdapter Article at CodeProject
Rocky Lhotka's ObjectDataSource Frustration
I am not liking what I see.
The gist of all this seems to be that the ASP.NET 2.0 data binding controls are fine for ADO.NET data objects, but when you have custom business objects, a lot of coding jujitsu may be required. In other words, not only are you not saving time because you have to code a fair bit to make things like sorting and filtering work, but you are taking a leap of faith that the magic stuff being done for you behind the scenes is going to just work. The posts on the ASP.NET forums indicate a lot of issues that may consume quite a bit of time to debug. Again, it seems like for ADO.NET data objects, it works mostly, but for custom business objects, the jury is out.
Peter Kellner's experience (above) is another twist. To use SqlDataSource when a query requires filtering based on the current user id (a pretty common requirement), he documents a somewhat arcane technique to get this to work declaratively. That's cool, but now we're creating more "maintenance debt," and I'm left wondering what else is lurking to trip me up if I go down this recommended path.
We really should be able to implement some well-defined interfaces in our business objects and just have this stuff work. That has to be the best approach, and I have to think this is very close to being possible right now. I am going to check this out a bit more before I give up and go back to "DataSource = " and "DataBind()" and other trusted but monotonous ways.
No comments:
Post a Comment