Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linq to SQL Extensibility Method Definitions

If I have a Linq table of say User and I then do something like this;

public partial class DataAccessDataContext
{
    partial void UpdateUser(User instance)
    {
        //do something here
    }
}

What ends up happening is that the record is never updated in the database.

As soon as I get rid of the UpdateUser method the database is again updated.

I found something on the web that mentions that as soon as you implement any of the three extensibility methods of Insert, Update and Delete, then the database is no longer updated.

Is this correct and is there a way I can get this to work?

like image 925
griegs Avatar asked Dec 08 '25 10:12

griegs


1 Answers

You need to call the Dynamic update method like;

this.ExecuteDynamicUpdate(instance);

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!