make i.E. SQLCommand implement ICloneable

  • Thread starter Thread starter Anton Sommer
  • Start date Start date
A

Anton Sommer

Hello folks,

how can I make an Object (i.E. SQLCommand which does not have a clone
method) make implement ICloneable so that I can use its Clone method to
clone it.

Thank you

Anton

Environment: WinXP, VS .NET 2003
 
"Anton Sommer" <[email protected]> expressed in the message
known far and wide by the name thusly:
Hello folks,

how can I make an Object (i.E. SQLCommand which does not have a clone
method) make implement ICloneable so that I can use its Clone method to
clone it.

Hi Anton,

Two ways come to my mind readily -- 1) subclass the class and include the
IClonable interface on the subclass. This has several drawbacks, especially
with "leaf" classes that are highly specialized like the SQLCommand. And,
2) Create a utility class with a static method which will clone the
SQLCommand object and return that clone.

The latter will probably give you less headaches.

-rory 8)
 
Thank you for responding Rory

Two ways come to my mind readily -- 1) subclass the class and include the
IClonable interface on the subclass. This has several drawbacks, especially
with "leaf" classes that are highly specialized like the SQLCommand. And,
2) Create a utility class with a static method which will clone the
SQLCommand object and return that clone.

I am going for number 2 you are right because when subclassing the
command(number 1), a normal command cannot be changed with ctype() to a
subclassed command. And i.e. the command builder is returning normal
commands.


Thank you


Anton
 
Back
Top