Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich design pattern for Activity Logging (Audit Trailing)
    primarykey
    data
    text
    <p>I have a winform which allows people to edit data from a database, to simplify things assume there is a Customer table in database with 3 fields - Name, City, Country. Through winform(s) people can Add/Edit/Delete customers.</p> <p>For each of these actions we need to save:</p> <ol> <li><p>What the field names are (Name,City,Country in this case)</p></li> <li><p>What the field values were before they were modified</p></li> <li><p>What the field values are after they are modified.</p></li> </ol> <p>If the action is Add or Delete then 2 and 3 will be the same.</p> <p>I have already implemented this using XMLSerialisation (but not using any of the design patterns) and my XML output looks like this.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ActivityItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;UserID&gt;26&lt;/UserID&gt; &lt;FormTitle&gt;frmCustomer&lt;/FormTitle&gt; &lt;Action&gt;Edit&lt;/Action&gt; &lt;Area&gt;Customers&lt;/Area&gt; &lt;TrackedActivity&gt; &lt;FieldNames&gt; &lt;string&gt;Name&lt;/string&gt; &lt;string&gt;City&lt;/string&gt; &lt;string&gt;Country&lt;/string&gt; &lt;/FieldNames&gt; &lt;PreValues&gt; &lt;string&gt;CompA&lt;/string&gt; &lt;string&gt;London&lt;/string&gt; &lt;string&gt;UK&lt;/string&gt; &lt;/PreValues&gt; &lt;PostValues&gt; &lt;string&gt;CompB&lt;/string&gt; &lt;string&gt;Manchester&lt;/string&gt; &lt;string&gt;UK&lt;/string&gt; &lt;/PostValues&gt; &lt;/TrackedActivity&gt; &lt;DateTimeStamp&gt;2012-06-15T10:16:18&lt;/DateTimeStamp&gt; &lt;/ActivityItem&gt; </code></pre> <p>The solution can handle different areas of the system with different number of fields (i.e the same thing works when you are modifying Products for instance).</p> <p>My question is, is there a well defined design pattern to deal with this kind of behavior?</p> <p>Many Thanks</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.
 

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