.NET Performance Blog

April 21, 2006

MSDN documentation is incorrect on using DataObjectTypeName with SelectMethod

Filed under: .NET — Eric P @ 6:39 pm

When reading MSDN documentation for ObjectDataSource.SelectMethod I found the following paragraph.

If the DataObjectTypeName property is set, the method is resolved in a different way. The ObjectDataSource looks for a method with the name that is specified in the SelectMethod property that takes one parameter of the type that is specified in the DataObjectTypeName property. In this case, the name of the parameter does not matter.

I tried it, but it doesn't look like it works. ObjectDataSource still looks for a method that has multiple SelectParameters arguements and not one 'DataObjectTypeName' arguement.

This is inconsistent with documentation for 'ObjectDataSource.DataObjectTypeName' where it says that:

Instead of specifying several parameters that are passed to the Update, Insert, and Delete methods, you can create one object that aggregates several data field values. This one object is passed to the methods, instead of several parameters.

Since my 'Select' method can have dozens of parameters I would rather use a class then dozens of arguements. I think the reason it works diferently from (Update/Insert/Delete) is that in some cases Search Arguements may be different from the ones required for Insert/Update/Delete. For example class Customer may have 'DateCreated', but CustomSearch will have 'DateCreatedFrom' and 'DateCreatedTo'.

The solution would be to provide another ObjectDataSource property 'SelectDataObjectTypeName' and hopefully MS can implement it for next update. For now they just need to fix up the documentation.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: