I have a Linq-to-SQL class, and I would like to do a preliminary check before the record is saved to the database. In addition, as soon as it is saved, I would like to have a processing code after saving.
Similarly, when a record is deleted, I would like to have preliminary and post methods that will be called, regardless of where the call is made context.SubmitChanges().
I do not see any methods in the generated code that I can override. A partial method OnValidate()may be sufficient for preprocessing, but I want to cancel the save if certain conditions are not met, and I do not see any intercepts for further processing.
Am I missing something? Or can you recommend another way to achieve the intended effect?
Thanks!
source
share