I have heard that Linq query write once can be run on SQL and MS Access database too. Is it right or wrong?
For example I want to write queries once regardless of database type like currently I’m using MS Access database and later then if I wish to move on to SQL Server then I don’t want to change my queries. Is this possible??
It depends in part on the queries. For simple queries (select, where, orderby) you should be fine, but there are a lot of implementation-specific details.
For example:
Firston a set you haven’t explicity ordered : LINQ-to-SQL is fine with that, LINQ-to-Entities will failExpression.Invoketo build a gnarly custom expression : again, LINQ-to-SQL is fine, LINQ-to-Entities will fail.Where(predicate).FirstOrDefault()vs.FirstOrDefault(predicate)– which are semantically identical, but IIRC only one works (in Astoria)My point is; it might work, but you do need to test against the specific implementation.