make i.E. SQLCommand implement ICloneable

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
 
R

Rory Plaire

"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)
 
A

Anton Sommer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top