Hello,
In my current project i'm having a problem. The OnValidateEntityBeforeSave is not called whilst expecting it should here. I'm currently using .NET2.0 and LLBLGen Pro 2.5
In short I designed a new usercontrol with the fields of a RelatieEntity, bound to a RelatieEntityBindingSource. I then do the following in code to create a new entity.
' create a new relatie panel with a new entity attached to the entitybinding source.
Dim pnl = New RelatiePanel(New RelatieEntity())
Inside the panel there is a save method which will do the follwing to save the entity.
Public Sub Save()
Dim relatie As RelatieEntity = CType(RelatieEntityBindingSource.Current, RelatieEntity)
Try
relatie.Save()
Catch ex As Exception
' Write an error
End Try
End Sub
When i make the call to relatie.Save i expect the OnValidateEntityBeforeSave to fire but it doesn't.
I implemented a partial class for overriding the handler like so
Namespace MyApp.LLBLGen.EntityClasses
Partial Public Class RelatieEntity
Protected Overrides Sub OnValidateEntityBeforeSave()
MyBase.OnValidateEntityBeforeSave()
End Sub
Protected Overrides Function OnValidateFieldValue(ByVal fieldIndex As Integer, ByVal value As Object) As Boolean
MyBase.OnValidateFieldValue(fieldIndex, value)
End Sub
End Class
End Namespace
I placed two breakpoints. One inside OnValidateFieldValue and one in OnValidateEntityBeforeSave. It does break in OnValidateFieldValue but it does not break in the OnValidateEntityBeforeSave.
I also tried using a Validator class but i got the same problem there.
The reason i'm using the OnValidateEntityBeforeSave is to check if a Code field is set. If the field is not set i generate a new unique value for it and set it just before the entity is inserted into the database.
Hope you can help me with this problem ( / bug )
Kind regards,
Daniƫl