Kirk Marple

Musings of a Yukon and Whidbey pioneer... and feeling the arrows in my back...

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910


Navigation

Subscriptions

Post Categories



DbParameter.CopyTo now obsolete... Reflector to the rescue

I'd been using DbParameter.CopyTo method for cloning DbParameters, but then found with the Nov CTP that it's going away (marked obsolete).

Unfortunately, MSFT failed to provide any documentation as to what to use instead. I've posted newsgroup msgs and filed a Product Feedback Center question about it, but got no response.

Since i was getting back to my .NET 2.0 project today, i pulled out Lutz Roeder's .NET Reflector to try and solve this. Man, this is the *best* free tool out there. It's just indispensible for figuring out the intricacies of the Frameworks, especially where there's no documentation available.

It's interesting because it basically converts the Frameworks into an "exposed source" library, like MFC used to be.

Here's what CopyTo looks like:

[Obsolete("Do not use, will be removed post pd9.")]
public override void CopyTo(DbParameter destination)
{      

ADP.CheckArgumentNull(destination, "destination");      
this.CloneHelper((SqlParameter) destination);
}

But if it's going away, I needed a replacement. So, I noticed that CopyTo was calling CloneHelper, and also saw that .ctor(SqlParameter) called CloneHelper. But it also called ICloneable.Clone. It hit me that using ICloneable.Clone is probably the "preferred" approach (since CloneHelper is private). I tried replacing CopyTo with that, and it looks like it's working so far.

posted on Friday, January 07, 2005 11:02 AM by kmarple


# re:DbParameter.CopyTo now obsolete... Reflector to the rescue @ Monday, April 11, 2005 5:28 AM

^_^,Pretty Good!

kmarple

# re:DbParameter.CopyTo now obsolete... Reflector to the rescue @ Monday, April 11, 2005 9:38 PM

^_^,Pretty Good!

kmarple

# re:DbParameter.CopyTo now obsolete... Reflector to the rescue @ Friday, April 15, 2005 10:18 AM

^_^,Pretty Good!

kmarple

# re:DbParameter.CopyTo now obsolete... Reflector to the rescue @ Monday, May 16, 2005 10:41 AM

^_~,pretty good!csharpsseeoo

kmarple




Powered by Dot Net Junkies, by Telligent Systems