190 likes | 282 Views
Language Integrated Query. Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com. Agenda. Why do we want LINQ? How are query capabilities added to the languages? What is LINQ enabled in VS2008 & Fx 3.5? What is LINQ enabled after VS2008?.
E N D
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com
Agenda • Why do we want LINQ? • How are query capabilities added to the languages? • What is LINQ enabled in VS2008 & Fx 3.5? • What is LINQ enabled after VS2008?
Why do we need LINQ? My Code Query As String Loosely typed result “API” Objects SQL XML
Language Syntax for Querying fromitemNameinsrcExpr joinitemNameinsrcExpronkeyExprequalskeyExpr (intoitemName)? letitemName= selExpr wherepredExpr orderby(keyExpr(ascending| descending)?)* selectselExpr groupselExprbykeyExpr intoitemName query-body
LINQ in the Languages • Many new language features in VB9 & C# 3 VB9 C# 3.0 XML Literals Anonymous Types Collection Initialisers Extension Methods Relaxed Delegates Lambdas Object Initialisers Implicit Typing Partial Methods
LINQ in the Languages • Some are enablers for LINQ VB9 C# 3.0 XML Literals Anonymous Types Collection Initialisers Extension Methods Relaxed Delegates Lambdas Object Initialisers Implicit Typing Partial Methods
Query Pattern -> Language Features • Compiler looks for extension methods which extend IEnumerable<T> IQueryable<T>
IEnumerable<T> & IQueryable<T> • IEnumerable – query executed piece by piece • IQueryable – query executed in one go where select Execute Execute where select Capture & Execute
Beyond VS 2008 – ADO.NET V3.0 ADO.NET V3.0 & Entity Framework Query with LINQ to Entities, Entity SQL ADO.NET Entity Provider (EntityClient) Conceptual Data Model Mapping ADO.NET V2.0 ADO.NET Provider (e.g. SqlClient, OracleClient, etc) DataStore (SQL, Oracle, etc)
Summary • LINQ plumbed into VB9 and C#3.0 Languages • Lots of other language features too • LINQ enabled in .NET Framework V3.5 • Objects, SQL, XML, DataSet • LINQ enabled post .NET Framework V3.5 • Entities • ...
Resources • http://msdn.microsoft.com/vstudio • MSDN LINQ Developer Centre • http://tinyurl.com/3e2qpo • ADO.NET Team Blog • http://blogs.msdn.com/adonet
MSDN in the UK • Visit http://msdn.co.uk • Newsletter • Events • Nugget Videos • Blogs