title: How to use case and order by in Nhibernate?
body: <p>I need to order result in DB table <code>ChargeOperations</code> in <strong>my own direction</strong> by <code>typeId</code>.
  The SQL request is like this:</p>
  
  <pre><code>SELECT * FROM ChargeOperations co
  LEFT JOIN ShadowChargeOperations sco ON sco.ChargeOperationId=co.Id
  -- just exclude some extra data.
  WHERE sco.Id IS NULL
  ORDER BY
   CASE co.TypeId
    WHEN 1 THEN 3   -- this is my order, which is different from id of type and can change
    WHEN 2 THEN 1
    WHEN 3 THEN 2
    ELSE 4
   END,
   co.TypeId,
   co.CalculationAmount
  </code></pre>
  
  <p>So, please, can you give me an example of how can I create this construction.</p>
  
  <pre><code>CASE co.TypeId 
    WHEN 1 THEN 3   -- this is my order, which is different from id of type and can change
    WHEN 2 THEN 1
    WHEN 3 THEN 2
    ELSE 4
  </code></pre>
  
  <p>with QueryOver.</p>