Hi,
What is the difference between comprehensive queries and lamba queries in linq.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 17, 2011, 8:12 AM EDT
AartiRank #2,383 · 594 reputationPosted Nov 14, 2011, 2:08 AM EST
Lambda expressions are the natural evolution of anonymous methods :
Func filter = delegate (string s) { return s.Length == 5; }; Func extract = delegate (string s) { return s; }; Func project = delegate (string s) { return s.ToUpper(); }; IEnumerable query = names.Where(filter) .OrderBy(extract) .Select(project); for more refer this link: http://msdn.microsoft.com Thanks...Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 2, 2012, 9:55 PM EST
comprehensive queries Feature...
- Transparently query multiple databases in one expression e.g. a Microsoft Access Database and an SQL Server Database
- Translates function calls and property accessors in the String, DateTime and Nullable`1 classes that have SQL equivalents e.g. firstName.Length, firstName.ToUpper(), orderDate.Year, shippedDate.HasValue etc.
- Does not use MARS - Multiple Active Result Sets, an SQL Server 2005 specific feature
Lambda queryA lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions use the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x." This expression can be assigned to a delegate type.
example :
my table structure as below.
Customer ==> Address ==> Contact.
comprehensive query.
from c in ctx.Contacts
where c.Address.CustomerID = 123
and
select c
Lambda Query.you may also refer :
http://msdn.microsoft.com/en-us/library/bb308959.aspx
hope this help.