Hi
Depends on how you've implemented your validation logic but something like the following might set you in the right direction:
1) the following would go in your EntityBase class (assuming you have one)
Code:
Public ReadOnly Property IsValid() As Boolean
Get
For Each c As esColumnMetadata In Me.Meta.Columns
If Not Validate(c.Name, Me, c) Then Return False
Next
Return True
End Get
End Property
Note that the above assumes your Validate() method returns a Boolean - if it returns a string instead then you'd need to change the following line:
Code:
If Not Validate(c.Name, Me, c) Then Return False
to -
Code:
If Not Validate(c.Name,Me,c) = "" Then Return False
2) This would go in your CollectionBase class
Code:
Public ReadOnly Property IsValid() As Boolean
Get
For Each e As EntityBase In Me
If Not e.IsValid Then Return False
Next
Return True
End Get
End Property
3) And you'd call it like this:
If not myCollection.IsValid then ....show your "Not valid" message or whatever, else....Save
Hope that helps a little
Martin