views:

548

answers:

2

Preamble:

So, over the past 5 years or so various applications and tools have been written here at my company. Unfortunately many of the people who developed these applications used strongly typed datasets, I'm considering outlawing them in our shop now...

One of the larger processes that used strongly typed datasets is now timing out... I intend to rewrite the the whole process using nHibernate in the next few months but for the moment I need to change the timeout to allow our users to use the process, albeit slowly... Unfortunately Microsoft made the commandtimeout methods private so I can't access them directly.

The only solution I've come across so far is to create a partial class for each TableAdapter and include the timeout methods there...

This is quite clunky as it would mean adding partial classes for quite a few TableAdapters...

Anyone know of a more efficient way to handle this?

Thank you,

Gary

A: 

You don't say what language you're using. The following is in VB.NET since I happened to find such an example first:

Namespace AdventureWorksPurchasingDSTableAdapters
    Partial Public Class SalesOrderHeaderTableAdapter
 Public Property SelectCommandTimeout() As Integer
     Get
  Return Adapter.SelectCommand.CommandTimeout
     End Get
     Set(ByVal value As Integer)
  Adapter.SelectCommand.CommandTimeout = value
     End Set
 End Property
    End Class
End Namespace
John Saunders
Right, but thats what I'm trying to avoid doing... Individually it's easy to do... If you've got several hundred table adapters for several hundred datasets it's really not very viable.
Gary
I can't think what else you could do. There's no global CommandTimeout property. If there were, it would still somehow have to set the individual SqlCommand.CommandTimeout properties.
John Saunders
Why can one not adjust the CommandTimeout property in the Dataset Designer? And why is it still 30 seconds when i change the Connection Timeout to 300 seconds? Btw, what's the difference among these?Thanks in advance...
Tim Schmelter
Tim, if you have a question, ask a separate question. This is not a discussion group, and comments are not threads.
John Saunders
+1  A: 

Ok, so far as I can tell there's no shortcut / workaround for these situations. Thanks to John for trying.

My best advice is don't use MS datasets outside of quick and dirty prototyping... When your application grows and needs to be expanded you've only got the dirty left :)

Gary
This is a fairly narrow basis on which to condemn typed DataSets. However, it's a great basis for a feature suggestion on Connect (http://connect.microsoft.com/visualstudio/). Once you've posted the suggestion, edit this answer with the URL of the suggestion, so that others may vote for how important we feel it is.
John Saunders
Well, this issue isn't the only basis for that statement... The single biggest issue I have with datasets is the lack of intelligent defaults... If your config file doesn't have the right connection string in it then it defaults to whatever connection string it was created with... My gut feeling on that issue is that in any situation where there is any ambiguity then the only correct response is to throw an exception and die...
Gary
I'll put the suggestion on Connect later this eve, I wasn't ignoring your suggestion :)
Gary