IdeaBlade DevForce 2010 Help Reference
CloneCore Method
See Also  Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityAspect Class : CloneCore Method



For internal use only. Makes a copy of the entity including its EntityState; it does not copy related entities.

Syntax

Visual Basic (Declaration) 
Public Overridable Function CloneCore() As EntityAspect
Visual Basic (Usage)Copy Code
Dim instance As EntityAspect
Dim value As EntityAspect
 
value = instance.CloneCore()
C# 
public virtual EntityAspect CloneCore()
C++/CLI 
public:
virtual EntityAspect^ CloneCore(); 

Remarks

CloneCore copies the Entity "in depth" including the entity’s EntityState. Related entities are not copied. Derived classes that override CloneCore typically call base.CloneCore first to let DevForce do the initial cloning before proceeding to their custom functionality.

Beware: the result of CloneCore is not attached to any EntityManager even though the value of its EntityState indicates that it is! CloneCore should be called only within a Clone() method that understands this and that will ultimately expose the cloned entity as a properly formed entity with a correct EntityState.

The source EntityState is preserved so that the calling Clone() method can know and make use of the source entity’s EntityState. It is critical that the calling Clone() method return a properly formed Entity which means that, unless the method attaches the clone to a different EntityManager, the returned clone’s EntityState should be reset to "Detached".

CloneCore is called within other DevForce Clone() methods (EntityGroup.Clone for example). You can invoke it yourself by casting the entity as System.ICloneable and calling Clone() as in (Foo) ((ICloneable) foo).Clone()). The resulting clone does not belong to an EntityManager and its EntityState is "Detached".

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.