''' ''' Contains interfaces and classes to help support serialization ''' of objects. ''' Namespace Serialization ''' ''' Objects can implement this interface if they wish to be ''' notified of serialization events. ''' ''' ''' ''' Note that .NET serialization does NOT call these methods. Only ''' code that checks for the ISerializationNotification interface ''' when serializating and deserializing objects will invoke these ''' methods. ''' ''' The CSLA .NET framework's DataPortal processing and the Clone ''' method in BusinessBase automatically make these calls. ''' ''' Public Interface ISerializationNotification ''' ''' This method is called before an object is serialized. ''' Sub Serializing() ''' ''' This method is called on the original instance of the ''' object after it has been serialized. ''' Sub Serialized() ''' ''' This method is called on a newly deserialized object ''' after deserialization is complete. ''' Sub Deserialized() End Interface ''' ''' Helper methods for invoking the ISerializatoinNotification ''' methods. ''' Public Class SerializationNotification ''' ''' Invokes the Serializing method on the target object ''' if it has implemented ISerializationNotification. ''' ''' Object on which the method should be invoked. Public Shared Sub OnSerializing(ByVal target As Object) If TypeOf target Is ISerializationNotification Then DirectCast(target, ISerializationNotification).Serializing() End If End Sub ''' ''' Invokes the Serialized method on the target object ''' if it has implemented ISerializationNotification. ''' ''' Object on which the method should be invoked. Public Shared Sub OnSerialized(ByVal target As Object) If TypeOf target Is ISerializationNotification Then DirectCast(target, ISerializationNotification).Serialized() End If End Sub ''' ''' Invokes the Deserialized method on the target object ''' if it has implemented ISerializationNotification. ''' ''' Object on which the method should be invoked. Public Shared Sub OnDeserialized(ByVal target As Object) If TypeOf target Is ISerializationNotification Then DirectCast(target, ISerializationNotification).Deserialized() End If End Sub End Class End Namespace