C:\Proyectos\Ventas\Gestion de Pedidos\DetalleFacturaVenta.vb(25): 'Public Property ContainerObject() As AToMSFramework.CPersistentObject' est obsoleta: 'Changes in collection management have made this obsolete. Please use the ListChanged event for equivalent functionality'
what happen?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the change to handle collection state before and after transaction rollback I discovered some issues with copying objects and handling references etc.
As a result I discovered that the ContainerObject property is unreliable and can incorrectly dirty a different object than expected (due to reference copying).
I haven't managed to fix it properly, but I have fixed the events. What this means is that you should be capturing the ListChanged event of the collection and setting your dirty flag manually.
For example
Imports System.ComponentModel
Class MyClass
Inherits CPersistentObject
Private WithEvents MyColl as CPersistentCollection
...
Private Sub MyColl_ListChanged(ByVal sender as Object, ByVal e as ListChangedEventArgs) Handles MyColl.ListChanged
Me.SetDirtyFlag
End Sub
End Class
If you don't change the code then you are unlikely to get the dirty flag set on the parent object when the collection changes.
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a mistake:
C:\Proyectos\Ventas\Gestion de Pedidos\DetalleFacturaVenta.vb(25): 'Public Property ContainerObject() As AToMSFramework.CPersistentObject' est obsoleta: 'Changes in collection management have made this obsolete. Please use the ListChanged event for equivalent functionality'
what happen?
It's not a mistake, it's a compiler warning.
With the change to handle collection state before and after transaction rollback I discovered some issues with copying objects and handling references etc.
As a result I discovered that the ContainerObject property is unreliable and can incorrectly dirty a different object than expected (due to reference copying).
I haven't managed to fix it properly, but I have fixed the events. What this means is that you should be capturing the ListChanged event of the collection and setting your dirty flag manually.
For example
Imports System.ComponentModel
Class MyClass
Inherits CPersistentObject
Private WithEvents MyColl as CPersistentCollection
...
Private Sub MyColl_ListChanged(ByVal sender as Object, ByVal e as ListChangedEventArgs) Handles MyColl.ListChanged
Me.SetDirtyFlag
End Sub
End Class
If you don't change the code then you are unlikely to get the dirty flag set on the parent object when the collection changes.
- Richard.