Just starting getting into Entity Framework and Linq for EF. I’m not sure which of the two query methods I should concentrate on, method-based or query-based?
Is there an obvious choice as to which one is easier to use, for both simple and more complex queries, hence should be the one I concentrate on? Assuming I’m using VS2010 does method based have an advantage in terms of having more design time checks/prompts from the IDE to make it easier to get things right prior to running the application?
thanks
The method syntax is more complete; there will be things you can’t do with the query syntax without plugging in a method here or there inline. Also, for some very simply queries, the method syntax can seem more concise, IMO.
On the other hand, the query syntax can appear to describe a query more naturally to someone familiar with SQL.
I always figured I would use the Method syntax exclusively when I started learning Linq in general. But I do find myself pounding out query syntax queries sort of automatically at times, too. Perhaps you could concentrate on the Method syntax due to the completeness and the familiarity factor (if those are at all valuable to you), and maybe you’ll find that the query syntax just sort of ‘comes to you’ as you go, too.