I have a very basic Linq query which is not returning the same result if I execute it locally in Visual Studio or on an IIS server - but always targeting the same database server. I have used SQL Server Profiler to trace the real SQL query executed and found out that it was not the same when executing locally or remotely !
Locally it uses a Left join while remotely it uses an Inner join - and so locally it returns a record but not remotely. I think the good behavior would be the second as I defined a non nullable foreign key between TableA and TableB. Below is the Linq request:
from a in TableA.Include("TableB.TableC")
where a.Id == someId
select a;
In fact the first join is always translated in an Inner join, but the second is a left join when executed locally.
But my priority is to know why it generates a different query locally and remotely. The framework versions are the same, Entity framework versions are the same (copied locally)... Something must be different but I cannot find what ! Do you have any clue ?
Thank you in advance.