Problems Creating Custom DataSource Enabled Controls in ASP.NET 2.0

I find it unfortunatle that Microsoft has made is way too difficult to write your own DataSource enabled controls.  Deriving from DataBoundControl, but it still does not seem to be a way to synchronously get the data from the DataSource.  In a DataBoundControl control you can get the DataSourceView like so:

DataSourceView view = this.GetData();

Great!  Except that to actually get the code from the view requires you call view.Select() which is asynchronous.  Luckily for Microsoft, their controls use a friend/internal method called ExecuteSelect().  If you look into the code that the GridView, FormView and DetailsView use, they don't call it asynchronously, but you have to ;)

There was a LadyBug filed...but was marked as "We're not taking new suggestions for Whidbey any more". 

That leaves the control designer with two options, call it asynchronously or use reflection hackery to call ExecuteSelect.  ARG!

Comments:

I belive you're not wrong. I'm not using .NET Framework 2.0 yet, but month ago I was working on project in which I was using DataBinding with Typed Dataset.
Project was planned to be done in 3 weeks. It was just a little complex windows forms control embedded in IE.
Project lengthtens into 2 month because of System.Data and CurrencyManager bugs/problems.
Many of them could be easy to walk around by just override/call methods which was private/internal/not virtual.
I was forced to study .NET source code and I was strucked by too much use of such methods/properties.
I don't like sealed SqlConnection class also.
I can't understand such way of programing. Why they do this such way?


 



 
Save Cancel