LINQ To SQL OnValidate doesn't fire
Technorati Tags: LINQ To SQL
I spent half an hour tracking this down today and couldn't find it based a google search of the blog title. So.....If your OnValidate code isn't firing in your LINQ to SQL, your probably working with an out-of-date signature. Somewhere between Beta 2 and RTM, they snuck in a slight change by adding a parameter to indicate what kicked off the method.
Make your signature similar to:
Private Sub OnValidate(ByVal action as ChangeAction)
The ChangeAction enumeration values are Insert, Update, Delete and None. So if you need special code for the insert versus the update, you can code an IF statement appropriately.
You can find all of the breaking changes here.
Comments