Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As we use LINQ2SQL this task is quite easy to be acoomplished overriding the SubmitChanges() method. Our main goal is to do auditing in our tables. The code would like this:</p> <pre><code> /// &lt;summary&gt; /// Sends changes that were made to retrieved objects to the underlying database, /// and specifies the action to be taken if the submission fails. /// NOTE: Handling this event to easily perform Audit tasks whenever a table gets updated. /// &lt;/summary&gt; /// &lt;param name="failureMode"&gt;The action to be taken if the submission fails. /// Valid arguments are as follows:&lt;see cref="F:System.Data.Linq.ConflictMode.FailOnFirstConflict"/&gt; /// &lt;see cref="F:System.Data.Linq.ConflictMode.ContinueOnConflict"/&gt;&lt;/param&gt; public override void SubmitChanges(System.Data.Linq.ConflictMode failureMode) { //Updates for (int changeCounter = 0; changeCounter &lt; this.GetChangeSet().Updates.Count; changeCounter++) { object modifiedEntity = this.GetChangeSet().Updates[changeCounter]; SetAuditStamp(this, modifiedEntity, ChangeType.Update); } //Inserts for (int changeCounter = 0; changeCounter &lt; this.GetChangeSet().Inserts.Count; changeCounter++) { object modifiedEntity = this.GetChangeSet().Inserts[changeCounter]; SetAuditStamp(this, modifiedEntity, ChangeType.Insert); } base.SubmitChanges(failureMode); </code></pre> <p>We particulary don't like using triggers as they are always hidden into you DB and it makes hard to work out problems that may occur ... with having that into your code you just need to start debugging it to find out why something has failed for instance ...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload