title: Different versions of same dll and EF.
body: <p>We're have a couple of projects that integrate a business system to different external services. "We" are only writing the middleware and have no control of either system. When a breaking change occurs in a new version we'll have to cope somehow.</p>
  
  <p>Environment we're using is VS2013, C# and EF 5.0-6.NN</p>
  
  <p>The resources we rely on are:
   A number of Entity Framework models (model first for now, but is subject to change ). 
   3 dlls that needs to referenced.</p>
  
  <p>The resources have been very backward compatible until friday when we got a breaking change on the datatype of one field in one of the dlls. (Went from int to string).</p>
  
  <p>How can one approach this:
  Is it possible to load the same EF that targets different versions of the database?
  I understand that one would be forced to load them by different dll:s and so on, 
  but then, how should one approach the say linq queries and so on?</p>
  
  <p>Is it viable at hotspots do a check for say the type and recreate the whole LINQ expression?</p>
  
  <pre><code>if(typeof(Items.Prop) == typeof(int)){
    var things = from x in framework.Items where x.Prop = 2 select x;
  } else if(typeof(Items) == typeof(string)){
    var things = from x in framework.Items where x.Prop = "2" select x;
  }
  </code></pre>
  
  <p>Though, this should fail depending on the linq expression evaluation, since we're comparing it to the wrong datatype.</p>
  
  <p>Or should one create a specific executable for each version of the resource using</p>
  
  <pre><code>#ifdef __VER10
    var things = from x in framework.Items where x.Prop = 2 select x;
  #endif
  #ifdef __VER9
    var things = from x in framework.Items where x.Prop = "2" select x;
  #endif
  </code></pre>
  
  <p>But then, is it possible to do this automated tools that is provided by Visual Studio. And deployment of the correct executable becomes a problem in itself.  </p>
  
  <p>This question might be too loose for stack overflow, and I assume this is a common problem, but I'm not certain how to google for an answer.</p>