title: Converting rows in Columns
body: <p>I am developing an asp.net mvc application with NHibernate and I have a query where I would like to know how can I convert rows in columns?</p>
  
  <p>I have a dynamic system with a model like this:</p>
  
  <pre><code>// It's a kind of metadata
  public class Field
  {
     public virtual long Id { get; set; }
     public virtual string Name { get; set; }
  }
  
  // the value is here with respective field
  public class FieldValue
  {
     public virtual long Id { get; set; }
     public virtual Field Field { get; set; }
     public virtual string Value { get; set; }
  }
  </code></pre>
  
  <p>I would like to know how can I get a result where columns are the Field objects and values are FieldValue objects, should I create a ViewModel?  or a way to do it with asp.net mvc?</p>
  
  <p>I can do a query to get a result like this:</p>
  
  <p><img src="https://i.stack.imgur.com/gjFEn.png" alt="enter image description here"></p>
  
  <p>But I would like to do a query like this (or a way to create a result on my View on the asp.net mvc):</p>
  
  <p><img src="https://i.stack.imgur.com/sky9F.png" alt="enter image description here"></p>
  
  <p>Thanks</p>