title: Linq to SQL to select rows whose DateTime field falls within any of a list of date ranges
body: <p>I have a list of DateRange objects, which have StartDate and EndDate properties.  I need to select all the rows from a table in my database which have a DateTime field that falls within any of those DateRanges.  So I'd like to do something like this:</p>
  
  <pre><code>// Using an IQueryable&lt;DateRange&gt; called dateRanges
  var tests = from test in dbContext.Tests
              where dateRanges.Any(range =&gt; range.StartDate &lt;= test.Date &amp;&amp; range.EndDate &gt;= test.Date)
              select test
  </code></pre>
  
  <p>This gives me an error because DateRange is not a primitive type and so LINQ to SQL can't use it.  Is there any other way to do what I'm trying to do here?  Been googling and trying different things for a couple hours, I feel like I'm very close but can't quite get there.  Thanks in advance.</p>