c# - Run function whenever a change is made in database -


i want run function whenever change made in database.

is there way avoid 3 loops ? here code:

    public void save()     {         system.data.linq.changeset changeset = db.getchangeset();          foreach (user user in changeset.inserts)         {             this.dosomestuff();         }          foreach (user user in changeset.updates)         {             this.dosomestuff();         }          foreach (user user in changeset.deletes)         {             this.dosomestuff();         }         db.submitchanges();     } 

just "converting" @adrianm comment answer:

foreach (user user in changeset.inserts.concat(changeset.updates).concat(changeset.deletes)  {     this.dosomestuff(); } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -