title: Storing dynamic JSON data in db and search by key-value
body: <p>I need store dynamic json in DB and search by key-value </p>
  
  <p>i have json</p>
  
  <pre><code>    [{
        "id": 1,
        "Type": "string",
        "FieldName" : "Test",
        "Value": "Test", 
      }, {
        "id": 2,
        "Type": "bool",
        "FieldName" : "Test2",
        "Value": "true", 
       "id": 2,
        "Type": "dropdown",
        "FieldName" : "dropDownTest",
        "Value": [{"text":"my placeholder", "Value": "myTestValue"}, {"text":"my placeholder2", "Value": "myTestValue2"}]
      }, 
      {
        "id": 3,
        "Type": "int",
        "Value": 133
  },
  {
        "id": 4,
        "Type": "DateTime",
        "Value": ""
  }]
  </code></pre>
  
  <p>This json generated by admin-site. Admin has a panel where he can add columns, fieldType and the default value (or array of values if this drop-down)</p>
  
  <p>This json transform to form, which user fill on site and store to DB</p>
  
  <p>Data for saving look like this:</p>
  
  <pre><code>   [{
        "QuestionId": 1,
        "Value": "Test", 
        }, 
      {
        "QuestionId": 2,
        "Value": true, 
      },
      {
        "QuestionId": 4,
        "Value": "true", 
        "Value": "2018-09-16T20:03:57.551Z"
      }
      ]
  </code></pre>
  
  <p>Task: </p>
  
  <ol>
  <li>Store answers for users in DB</li>
  <li>Search by Answers in DB (filters on site, one or multiple matches e.g question 1 and 4 matches (value is "Test" and Date More then Yesterday...))</li>
  <li>Optimal structure for fast search</li>
  </ol>
  
  <p>My Vision:
  create an entity</p>
  
  <pre><code>public class QuestionEntity
  {
      public int id { get; set; }
      public string Type { get; set; }
      public string FieldName { get; set; }
      public string Value { get; set; }
  }
  </code></pre>
  
  <p>and create an answer entity </p>
  
  <pre><code>public class Answer
  {
      public int QuestionId { get; set; }
      public string Value { get; set; }
  }
  </code></pre>
  
  <p>And Add this Answers as user collections</p>
  
  <pre><code>public ICollection&lt;Answer&gt; Answers{get; set;}
  </code></pre>
  
  <p>I not sure what it's an optimal way for this task, and I will be grateful if someone to share their cases if you have them.</p>