littlechris
littlechris

Reputation: 4184

How do I override DataContext.SubmitChanges()?

I want to override the SubmitChanges() method for my model.

Whern I try to override I get a compiler error:

cannot override inherited member 'System.Data.Linq.DataContext.SubmitChanges()' because it is not marked virtual, abstract, or override

Is there anyway I can override this? Or do I have to create another method that runs my code and then runs the base SubmitChanges()?

Thanks

Upvotes: 3

Views: 1588

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499770

You can't override the parameterless overload, but you can override the one taking a ConflictMode parameter.

It's not documented that the first just calls the second with an appropriate conflict mode, but that's certainly what I'd expect.

Upvotes: 4

Related Questions