If you are like me and you store all your code on a server, you will have likely learned about trusting a network share using CasPol.exe. However, when moving from Visual Studio 2008 (.NET Framework 2.0/3.0/3.5) over to Visual Studio 2010 (.NET Framework 4.0), you may find yourself scratching your head.
Developing applications that communicate between different platforms can quickly hit ground if multi-byte integers are sent without taking the proper byte order into account. We often forgotten to watch for this as most of us stick to a single platform during development. Thankfully, the .NET Framework has taken all the guesswork out with a pair of simple methods.
The SqlDataAdapter has a CommandTimeout property but does offer any method to set any kind of timeout during the Fill method. If you are returning rather large data sets, you can quickly run into a problem. The obvious solution would be to inherit the SqlDataAdapter and simply override the Fill method, except that the SqlDataAdapter cannot be inherited. As a result, we must implement the same methods that the SqlDataAdapter does and attach them to a private internal SqlDataAdapter to do all the heavy lifting. With the use of anonymous delegates, we can easily rework the Fill methods to offer a new FillTimeout property and throw an exception when we exceed our desired timeout.