Hilton Giesenow's Jumbled Mind

Tuesday, July 27, 2004

Filling an ADO.NET DataTable from an ADO classic Recordset

I heard today on an old DotNetRocks! episode (in the interview with Andrew Brust) that the OleDbDataAdapter's Fill overloads can fill an DataTable based on an ADO classic recordset. This sounds interesting. It should really help with integration for legacy apps. Has anyone tried it?

Thursday, July 15, 2004

#Region Standards in Visual Studio.Net

Today I had a few thoughts about regions in Visual Studio.Net. For those unprivileged few who have to code in the Web Matrix Project (which I did for a few months) or Visual Notepad ++ ;-) Notepad, Visual Studio.Net allows you to group sections of source code together so that they can be expanded and contracted when you want, kind of like folders in Windows Explorer. Also, what some people don't know is that you can nest regions inside of one another. With this in mind, I started thinking about what some standards might look like here.

Standards, as we all know, is often a hairy topic. We've seen Hungarian Notation cause its debates (See MSDN Naming Guidelines). BTW, Chris Sells joked (in his DotNet Rocks! interview) about case sensitivity in C# being the "new Hungarian Notation" - that might explain SOME purpose in it for us Visual Basic.Net guys.

Anyways, the following are recommendations for first- and second-level region regions. Additional regions can be added at any levels at the developer’s discretion if it is felt that these will be in keeping with the goals of enhanced readability and navigation. In addition, regions that are unused are simply left out. If a sub-level is presented (e.g. see Methods below), the regions appear in descending order of scope. These sub regions are indented according to level.

Normal classes
These are the base regions for each class and are adjusted for Web Forms, Web Services, etc. as discussed below.
  • Variable Declarations
  • Constants
  • Enums
  • Properties
  • Constructors
  • Methods
     o Public Methods
     o Protected Methods
     o Private Methods
  • Code To Store

Web Forms / User Controls
As before, but with additions as follows:
  • Methods
     o Page Control Events
     o Lookup Methods (many of which may be public, e.g. for grid binding lookups)
     o …

Web Services
As before, but with additions as follows:
  • Methods
     o Public Methods
          Data Retrieval Methods
          Data Updating Methods

I'd love to hear anybody's thoughts on this.

Wednesday, July 14, 2004


I just recently discovered DotNetRocks! Its an online .NET radio show with interviews with some interesting and influential guys. Very much worth listening to. The show covers abosolutely everything and I'm enjoying listening to Dan Appleman, Pat Hinds, Mark Anders, and loads of others. They cover DotNet Remoting, serialization, reflection, obfuscation - you name it. It is hosted by franklins.net and also on MSDN at .NET Rocks! One thing that is particularly nice about the msdn files is that they are wrapped in an .exe, cos we are blocked from getting media files at my current client site (very frustrating!)

Wednesday, July 07, 2004

Some gripes about Typed Datasets and sqlDataAdapters

I am currently working on quite an interesting project. We have put out business and data layers a bit closer than usual, and are making use of typed datasets passed via Web to the presentation layer. I've touched on aspects of this type of Service Architecture approach before, but not quite in this way. We have encountered particularly irritating points so far. One is that the ADO.NET dataadapters are not able to deal with parent-child updating properly, and the other relates to annotating typed datasets.

The XML schemas for an ADO.NET typed dataset allows you to specify relationships between its tables. However, when you try and Update the changes using a DataAdapter it does not handle the changes correctly. The Update method iterates through the items sequentially, as one might expect. This causes problems though depending on the type of transaction. If the update method attacks the parent table first, and it processes a Delete, the children become orphaned. On the other hand, if you update the children first on an Insert, they become marked as Unchanged, and will not be updated when the parent is Inserted into the database and receives its proper real primary key. What we had to do was similar to the solution found in KB 310350 - How to update parent-child data with an Identity column from a Windows Forms application by using a Web Service in Visual Basic .NET. However, even this did not quite work. If anyone is interested in the solution, let me know and I'll provide more info.

The second problem related, as I mentioned, to annotating typed datasets (e.g. see Using Annotations with a Typed and also Using Annotations with a Typed DataSet). This concept allows the auto-generated objects to have proper names. For example, we have a convention of prefixing our lookup tables with "tlkp". Using these annotations, we can create a Audit type, and the table is called Audits, as opposed to the auto-"tlkpAudit" and "tlkpAuditTable". Much nicer :-). In addition, annotations let you specify defaults, etc. Now, using a typed dataset is fine with a Web Service. Adding the reference in Visual Studio.NET 2003 automatically pulls the schema across to the client application. HOWEVER (!!!) it does NOT pull the annotations! Nobody has yet been able to explain this one to me, and it is quite frustrating! Any comments would be appreciated!

Anyways, that's it for today. Back to the grind...

Hello World (sic)

Hello all, welcome to my new blog. I've been meaning to do this for a while, so here we go with the blogging...