title: linq query for sql xml column
body: <p>I would need to write a linq query in c# for the following sql query.
  I have no issues in implementing where, not in, orderby and descending but the problem is to query a sql xml column</p>
  
  <pre><code> SELECT [ID]
     ,[QueuedTime]
     ,Parameters.query('data(Root/Root/@type)').value('.', 'varchar(500)') as CommandName //how to implement this line in linq
     ,[Status]
     ,[CurrentRetryCount]
     ,[MaxRetryCount]
     ,[RetryDelaySeconds]
     ,[CompletedTime]
     ,[LastTriedTime]
     ,[LastError]
     ,Parameters
     ,[PrincipalString]
     FROM [AppServer].[dbo].[RequestQueue]
     where interfacename = 'ICommunicationsService'
    and MethodName = 'ProcessCommand'
    and status not in (1,2)
     order by id desc 
  </code></pre>
  
  <p>The following query will meet where, not in and order by descending conditions. I am concerned about how do I implement
     'Parameters.query('data(Root/Root/@type)').value('.', 'varchar(500)') as CommandName' in linq</p>
  
  <pre><code>   var unwantedStatus = new[] { 1, 2 };
  
     var operationTimedOutTasks = context.TblRequestQueues
                                                  .Where(t =&gt; t.MethodName == "ProcessCommand" &amp;&amp; !unwantedStatus.Contains(t.Status))
                                                  .OrderByDescending(t =&gt; t.ID)                                                
                                                  .ToList();
  </code></pre>