Danny
Danny

Reputation: 2821

Linq To Sql validation

I have a class containing Linq To SQL objects that are used to populate drop downlists on a view. Using Scott Gu's Nerd Dinner I am implementing the validation framework they use, using partial classes. This works fine when working with one object for (example dinner) per view. But when I use a class that is not a Linq To Sql object, I cannot get the validation working. Any ideas?

Upvotes: 0

Views: 404

Answers (1)

a7drew
a7drew

Reputation: 7821

The Nerd Dinner app leverages the events that are fired when Linq To SQL persists data. Specifically, the OnValidate() method.

Since you have a class that is not Linq To Sql, you can fake it by creating your own custom event handler and firing it when the data in the changes.

As an alternative, just call a method that validates a given object, calling as many validation functions as you have objects.

Upvotes: 1

Related Questions