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.
Environment we're using is VS2013, C# and EF 5.0-6.NN
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.
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).
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?
Is it viable at hotspots do a check for say the type and recreate the whole LINQ expression?
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;
}
Though, this should fail depending on the linq expression evaluation, since we're comparing it to the wrong datatype.
Or should one create a specific executable for each version of the resource using
#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
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.
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.