Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • 1
    Every LINQ provider is different and will produce different SQL, so you really cannot generalize. Furthermore, "reasonably complex query operations" will often be impractical, if not impossible, to translate into LINQ - and more often then not, if it is even possible, it will be considerably more time consuming than just writing the SQL in the first place. Commented Jan 6, 2012 at 6:36
  • @qes: A good comment, but I doubt this. Cannot generalize? Is the generated T-SQL or the algorithms used to generate it from e.g. LINQ-to-SQL and Entity Framework, really so fundamentally different? By time-consuming here I assume you mean development time, not running time (i.e. the question)? Even still, not necessarily. For example, suppose your query involved concatenation, other string manipulation, iteration,with persistence of some state from one row to the next, and calls to trigonometry functions... Commented Jan 6, 2012 at 6:48
  • You doubt it? How many LINQ providers have you worked with? L2S and EF are only 2 of dozens, and both from Microsoft at that. The algorithms used are quite different (even from L2S to EF, heck even from one version of EF to the next) for anything but the simplest single table select statements - and those are of no interest to your question it would seem. It will be considerably more time consuming, yes, in development time - as you fight to make a complex SQL statement simply translate from LINQ at all. Even reasonably simple joins in SQL can be tricky or even impossible Commented Jan 6, 2012 at 6:52
  • It seems you don't really understand how short most LINQ providers fall. String manipulation? Maybe 50/50 chance it's implemented. Iteration with persistence of state? Calling trig functions? Not happening. Use L2S, EF, SubSonic, LLBLGen, Lightspeed, etc. - at least a handful - and see what you find for yourself. And that's not even getting into using different LINQ providers against DB engines other than Microsoft SQL Server, another whole can of worms there. Commented Jan 6, 2012 at 6:53
  • 1
    Trig & financial - Used in stored procs. Not in LINQ. So if your sproc uses them, you won't be easily translating them into a LINQ query. String functions, like I said - maybe 50/50. Some are supported, some providers are better than others (try your string functions in SubSonic and see how many work). My point is that the type of SQL you are asking about - "reasonably complex query operations" - are more often than not, not going to be possible to simply write in LINQ - and even when you can accomplish it - runtime performance is irrelevant since development time will be lengthened. Commented Jan 6, 2012 at 8:07