Hi, Using V2.0, Adapter, VB
Am experimenting with ValidatorClasses and have some problems.
My RegionEntity DataGridView has 2 columns, populated with via calls to a Manager Class to get the collection. I'm trying to use ValidateEntity to validate row input in the grid, before leaving the row.
I've overriden ValidateEntity in my Validator class as follows:
Imports ARTEMIS.DAL.EntityClasses
Imports SD.LLBLGen.Pro.ORMSupportClasses
Namespace ValidatorClasses
Public NotInheritable Class ISORegionValidator
Inherits ValidatorBase
Public Overrides Sub ValidateEntity(ByVal involvedEntity As SD.LLBLGen.Pro.ORMSupportClasses.IEntityCore)
Dim toValidate As ISORegionEntity = CType(involvedEntity, ISORegionEntity)
If toValidate.ISORegionID = 10 Then
Throw New ORMEntityValidationException("ISORegion ID invalid", toValidate)
End If
MyBase.ValidateEntity(involvedEntity)
End Sub
End Class
End Namespace
Have also set the entity's validator via a partial class as follows:
Imports SD.LLBLGen.Pro.ORMSupportClasses
Namespace ARTEMIS.DAL.EntityClasses
Partial Public Class ISORegionEntity
Protected Overrides Function createValidator() As IValidator
Return New ValidatorClasses.ISORegionValidator()
End Function
End Class
End Namespace
I want to validate the row before leaving it, but I'm having difficulty in working out how to do so with the existing entity instance. If I use the following:
Dim myEntity As New ISORegionEntity
myEntity.ValidateEntity()
Then run the app and enter 10 for ISORegionID, ValidateEntity is called but toValidate.ISORegionID is of course 0.
How do I do this?
Thanks