I'm following along with an excellent Scott Guthrie article (MVC form posting scenarios) and trying to convert it to VB along the way. I've got everything working except one piece. At one point in the article he's adding his own business rules to a LINQ to SQL entity like this:
public partial class Product
{
partial void OnValidate(ChangeAction action)
{
...
}
}
In converting it to VB, I'm not sure how to translate the "partial" part of OnValidate. If I do this:
Partial Public Class Product
Private Sub OnValidate(ByVal action As ChangeAction)
...
End Sub
End Class
then the business rules I put in OnValidate work, but it doesn't throw any exceptions for bad data (i.e. character in a decimal field), which makes sense, since I'm basically overriding Product's validation.
What's the syntax to make sure the underlying class's OnValidate executes in addition to my version?
Edit: Note that making OnValidate "Partial Private Sub" produces the following errors:
- Partial methods must have empty method bodies.
- Method 'OnValidate' cannot be declared 'Partial' because only one method 'OnValidate' can be marked 'Partial'.