CommandBase may implement ICloneable to support AutoCloneOnUpdate=True

CommandBase may implement ICloneable to support AutoCloneOnUpdate=True

Old forum URL: forums.lhotka.net/forums/t/3582.aspx


ben posted on Monday, September 24, 2007

I think that CommandBase may implement ICloneable. Other ways there will be a System.InvalidCastException exception using AutoCloneOnUpdate = True at Csla.DataPortal.Update(Object obj), in DataPortal\Client\DataPortal.vb when we try to execute a derived command.

 

Benjamin.

RockfordLhotka replied on Monday, September 24, 2007

Ahh, good catch.

The solution is in svn, and is in DataPortal, where Clone() is now only called if the target object implements ICloneable. Implementing ICloneable isn't a pre-requisite for using the data portal, though obviously you do need to implement it if you want cloning to occur.

I've also made Csla.Core.ObjectCloner public to make it easier to implement ICloneable in objects that don't subclass one of the cloneable base classes.

Copyright (c) Marimer LLC