Note that there are some explanatory texts on larger screens.

plurals
  1. POStoring a Meta-Database
    primarykey
    data
    text
    <p>I'm at somewhat of a disagreement with a fellow colleague on this issue. First and foremost, the environment (guaranteed, will not change):</p> <ul> <li>SQL Server 2008 R2</li> <li>ASP.NET MVC 3</li> <li>C#</li> </ul> <p>And now, the scenario: I am working on an application which will give users the ability to collect input from users and store it for later reporting purposes. The methods of collecting input are in various types of controls they can place on the page. Collecting the data is not the issue; storing it is.</p> <p><strong>Database Within A Database</strong></p> <p>I follow the notion that it should be stored as a collection of key-value pairs (in this example, a table called <code>ResponseItems</code>):</p> <pre><code>+----------+----------+----+-----+ |ResponseId|FormItemId|Name|Value| +----------+----------+----+-----+ </code></pre> <p>Where the <code>ResponseId</code> and <code>FormItemId</code> form the primary key, the <code>ResponseId</code> relating to a <code>Response</code> table, as such:</p> <pre><code>+----------+------+------+-------------+ |ResponseId|FormId|UserId|SubmittedDate| +----------+------+------+-------------+ </code></pre> <p>And the <code>FormItemId</code> relating to a <code>FormItem</code> table:</p> <pre><code>+----------+------+----+-----------------+ |FormItemId|FormId|Type|InstantiationData| +----------+------+----+-----------------+ </code></pre> <p>Where <code>FormId</code> is the same as the <code>FormId</code> in the <code>Response</code> table, referencing a <code>Form</code> table, which is not as important to illustrate.</p> <p><strong>XML Serialization</strong></p> <p>I get back in response that serializing the form components and responses as XML makes more sense, such that it requires less bulk in terms of tables, leaving only a Form table:</p> <pre><code>+------+--------+ |FormId|Elements| +------+--------+ </code></pre> <p>and all instantiation data is stored within the XML data for each form element in the <code>Elements</code>. The responses are then similarly recorded:</p> <pre><code>+----------+------+-------------+----------------+ |ResponseId|UserId|SubmittedDate|ResponseElements| +----------+------+-------------+----------------+ </code></pre> <p><strong>The Short Question After The Long Preface</strong></p> <p>I think the first idea is cleaner and easier to report on. What do you think?</p> <p>As a final note, there are more tables to this, for both sides, as the forms are to be versioned for every time a user edits the form.</p>
    singulars
    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.
 

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