title: DateTime parameter issue with Linked Servers and Entity Framework Code First
body: <p>I have two databases on two servers.  My app primarily uses db1 on server1.  However, there is one table that I will only read from in db2 on server2.  </p>
  
  <p>Rather than created a new DbContext to db2, we created a Linked Server and set up a synonym for this table in db1.  I set up mappings for this in my db1 Code First Context.  this appears to be working and I can retrieve data.</p>
  
  <p>However, if I use any dates in my predicate, I get the following error:</p>
  
  <p><code>A failure occurred while giving parameter information to OLE DB provider "SQLNCLI10" for linked server "server2".</code></p>
  
  <p>My mapping looks like this:</p>
  
  <pre><code>ToTable("synonym");
  
  Property(t =&gt; t.Id).HasColumnName("ID");
  Property(t =&gt; t.Company).HasColumnName("Company");
  Property(t =&gt; t.StartDate).HasColumnName("StartDate");
  Property(t =&gt; t.EndDate).HasColumnName("EndDate");
  Property(t =&gt; t.LastUpdatedDate).HasColumnName("LastUpdatedDate");
  Property(t =&gt; t.LastUpdatedBy).HasColumnName("LastUpdatedBy");
  </code></pre>
  
  <p>I am trying to run the following query:</p>
  
  <pre><code>_context.Set&lt;Synonym&gt;()
      .Any(s =&gt; s.Company == company
              &amp;&amp; s.StartDate &lt;= date
              &amp;&amp; (s.EndDate &gt;= date || s.EndDate == null));
  </code></pre>
  
  <p>If I remove the dates, the query runs fine.</p>
  
  <p>server1 is SQL 2008<br>
  server2 is SQL 2005</p>
  
  <p>I found <a href="http://www.sqlservercentral.com/Forums/Topic843582-391-1.aspx" rel="noreferrer">this thread</a> that suggests there is some sort of issue with dates, but I cannot figure out how to apply it to Entity Framework.</p>