LINQ Providers Or why.NET rules, and Java doesn’t Branimir Giurov SofiaDev.org UG Lead, C# MVP Freelance Software Developer www.sofiadev.org.

Slides:



Advertisements
Similar presentations
Satisfy Your Technical Curiosity ADO.NET vNext The Entity Data Model, Object Services, and LINQ Bob Beauchemin Director of Developer Resources, SQLskills.
Advertisements

The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
Thomas Ball Microsoft Research. C# 3.0C# 3.0 Visual Basic 9.0Visual Basic 9.0 OthersOthers.NET Language Integrated Query LINQ to Objects LINQ to DataSets.
Deep Dive into LINQ Eran Sharabi.NET Development Team Leader JohnBryce Training
LINQ and Collections An introduction to LINQ and Collections.
Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
© Logica All rights reserved ADO vNext LINQ LINQ to SQL Entity Framework Freek Leemhuis
Joshua Clark Consultant Sogeti USA Blog:
.NET 3.0 & 3.5 Framework Team: Dan Stead Alex Nichols.
C# 3.0 & LINQ Raimond Brookman – IT Architect
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
C# Programming: From Problem Analysis to Program Design1 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
© Copyright SELA Software & Education Labs Ltd Baruch Hirsch St. Bnei Brak Israel Microsoft Entity Framework v1.1 over Oracle Database Erez.
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
Beth Massi Program Manager Visual Studio Community.
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
Overview of Microsoft.Net and Vb.Net ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Eric Vogel Software Developer A.J. Boggs & Company.
Session 1 - Introduction and Data Access Layer
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
Chapter 15: Using LINQ to Access Data in C# Programs.
LINQ TO XML Mike Taulty Developer & Platform Group Microsoft UK
Advanced C#, part IV Niels Hallenberg IT University of Copenhagen (With thanks to Peter Sestoft and Kasper Østerbye) BAAAP – Spring 2009.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
Лектор: Борислава Палева. Galin Iliev MCT, MCPD, MCSD.NET LINQ to XML.
LINQ: It’s Not Your Father’s Data Access Denny Boynton Anheuser-Busch Companies.
The.NET Language Integrated Query Project Anders Hejlsberg TLN306 Technical Fellow Microsoft Corporation.
© Satyam Computer Services Ltd POC Architecture 1 Confidential – Limited Circulation.
 Language Integrated Query  Make query a part of the language  Component of.NET Framework 3.5  Shipped with Visual Studio 2008.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
Oct * Brad Tutterow. VS 2008.NET 3.5LINQ Entity Framework  The ADO.NET Entity Framework is part of Microsoft’s next generation of.NET technologies.
Eric White Technical Evangelist Microsoft Corporation Session Code: OFC403.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
AUC Technologies LINQ (Language Integrated Query) LINQ Presented By : SHAIKH SHARYAR JAVED Software Engineer (Daedalus Software Inc.) Technology Teacher.
What is HTTP? - the underlying communication protocol used by the www - common HTTP headers?
Language Integrated Query (LINQ). Data Access Programming Challenges Developers must learn data store-specific query syntax Multiple, disparate data stores.
By: Luis Carranco CIS764 - Fall  What is LINQ  Architecture  How does it work?  Samples/Demo  Why to use LINQ? 2.
C#: Future Directions in Language Innovation Anders Hejlsberg TLN307 Technical Fellow Microsoft Corporation.
Applied Linq Putting Linq to work Introducing… Class-A Kennisprovider Microsoft development Training Coaching Alex Thissen Trainer/coach.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
Joel Pobar Language Geek Microsoft DEV320 Improve on C# % Backwards Compatible Language Integrated Query (LINQ)
ISYS 512 Business Application Design and Development with.Net David Chao.
LINQ Language Integrated Query LINQ1. LINQ: Why and what? Problem Many data sources: Relational databases, XML, in-memory data structures, objects, etc.
Ken Casada Developer Evangelist Microsoft Switzerland
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
LINQ and Lambda Expressions Telerik Software Academy LINQ Overview.
M ICROSOFT.NET Kyle Adamski 10/15/2012. Road Map What is.NET? Common Language Runtime (CLR) Language Integrate Queries (LINQ).NET Pros.NET Cons Sources.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Binding to ListBox and ComboBox Controls List and combo boxes are frequently.
Lecture Transforming Data: Using Apache Xalan to apply XSLT transformations Marc Dumontier Blueprint Initiative Samuel Lunenfeld Research Institute.
Biml Recipes: Automatically Create T-SQL Scripts for Common Tasks
Programmiersprache Entwickeln mit Visual Basic.NET?
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Language Integrated Query: (LINQ) An introduction
Language Integrated Query (LINQ)
Language Integrated Query (LINQ)
Advances for Data in VS “Orcas”
Advances for Data in VS “Orcas”
Технологии доступа к данным на платформе Microsoft.NET
04 | Data Acess Technologies
LINQ - 2 Ravi Kumar C++/C# Team.
Visual Studio 2008.
CS4540 Special Topics in Web Development LINQ to Objects
Presentation transcript:

LINQ Providers Or why.NET rules, and Java doesn’t Branimir Giurov SofiaDev.org UG Lead, C# MVP Freelance Software Developer

ContentsContents typeof(linq)typeof(linq) How does it work?How does it work? Lambda, extension methods, iteratorsLambda, extension methods, iterators typeof(linq)typeof(linq) How does it work?How does it work? Lambda, extension methods, iteratorsLambda, extension methods, iterators

typeof(linq)typeof(linq)

Objects <book> </book> XML.NET Language Integrated Query C# 3.0 VB 9.0 Others… Relational LINQ to Objects LINQ to SQL LINQ to XML LINQ to Entities LINQ to Datasets

typeof(linq)typeof(linq) LINQ to ObjectsLINQ to Objects LINQ to SQLLINQ to SQL LINQ to XMLLINQ to XML LINQ to DatasetsLINQ to Datasets LINQ to EntitiesLINQ to Entities LINQ to Windows SearchLINQ to Windows Search LINQ to GoogleLINQ to Google LINQ to SharepointLINQ to Sharepoint LINQ to nHibernateLINQ to nHibernate LINQ to ObjectsLINQ to Objects LINQ to SQLLINQ to SQL LINQ to XMLLINQ to XML LINQ to DatasetsLINQ to Datasets LINQ to EntitiesLINQ to Entities LINQ to Windows SearchLINQ to Windows Search LINQ to GoogleLINQ to Google LINQ to SharepointLINQ to Sharepoint LINQ to nHibernateLINQ to nHibernate

LINQ to Objects Query language over collections of objectsQuery language over collections of objects Standard SQL-like set of query operators, including joins and groupingStandard SQL-like set of query operators, including joins and grouping New query operators can be added, fully extensible (extension methods)New query operators can be added, fully extensible (extension methods) Intellisense and compiler syntax checking support in Visual StudioIntellisense and compiler syntax checking support in Visual Studio Query language over collections of objectsQuery language over collections of objects Standard SQL-like set of query operators, including joins and groupingStandard SQL-like set of query operators, including joins and grouping New query operators can be added, fully extensible (extension methods)New query operators can be added, fully extensible (extension methods) Intellisense and compiler syntax checking support in Visual StudioIntellisense and compiler syntax checking support in Visual Studio

LINQ to Objects How to query an array of int?How to query an array of int? public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = from n in numbers where n < 5 select n; Console.WriteLine("Numbers < 5:"); foreach (var x in lowNums) { Console.WriteLine(x); } }

LINQ to SQL Write queries in any.NET language to retrieve and manipulate data from SQLWrite queries in any.NET language to retrieve and manipulate data from SQL Use FK constraints for defining relations of data without joinsUse FK constraints for defining relations of data without joins Join in code on any column that has no FK definedJoin in code on any column that has no FK defined Use FK’s to query/modify data in SQL DBUse FK’s to query/modify data in SQL DB Call SubmitChanges() when you’re doneCall SubmitChanges() when you’re done Currently supports SQL 2000 & 2005Currently supports SQL 2000 & 2005 System.Date.Linq.SqlClient.Sql2000ProviderSystem.Date.Linq.SqlClient.Sql2000Provider System.Date.Linq.SqlClient.Sql2005ProviderSystem.Date.Linq.SqlClient.Sql2005Provider Write queries in any.NET language to retrieve and manipulate data from SQLWrite queries in any.NET language to retrieve and manipulate data from SQL Use FK constraints for defining relations of data without joinsUse FK constraints for defining relations of data without joins Join in code on any column that has no FK definedJoin in code on any column that has no FK defined Use FK’s to query/modify data in SQL DBUse FK’s to query/modify data in SQL DB Call SubmitChanges() when you’re doneCall SubmitChanges() when you’re done Currently supports SQL 2000 & 2005Currently supports SQL 2000 & 2005 System.Date.Linq.SqlClient.Sql2000ProviderSystem.Date.Linq.SqlClient.Sql2000Provider System.Date.Linq.SqlClient.Sql2005ProviderSystem.Date.Linq.SqlClient.Sql2005Provider

DEMODEMO LINQ to SQL ToString() Modifying Queries Mapping Styles Mapping Tools

LINQ to XML LINQ to XML is a new way to construct, write and read XML data in the.NET language of the developers’ choiceLINQ to XML is a new way to construct, write and read XML data in the.NET language of the developers’ choice Simplifies working with XMLSimplifies working with XML No more XPath or XSLTNo more XPath or XSLT Not a replacement for DOM or any of the current XML libsNot a replacement for DOM or any of the current XML libs Supports writing Query ExpressionsSupports writing Query Expressions Can be combined with any of the other LINQ technologiesCan be combined with any of the other LINQ technologies Supports SAX-style reading/writing of documents with the use of XStreamingElementSupports SAX-style reading/writing of documents with the use of XStreamingElement Differed executionDiffered execution LINQ to XML is a new way to construct, write and read XML data in the.NET language of the developers’ choiceLINQ to XML is a new way to construct, write and read XML data in the.NET language of the developers’ choice Simplifies working with XMLSimplifies working with XML No more XPath or XSLTNo more XPath or XSLT Not a replacement for DOM or any of the current XML libsNot a replacement for DOM or any of the current XML libs Supports writing Query ExpressionsSupports writing Query Expressions Can be combined with any of the other LINQ technologiesCan be combined with any of the other LINQ technologies Supports SAX-style reading/writing of documents with the use of XStreamingElementSupports SAX-style reading/writing of documents with the use of XStreamingElement Differed executionDiffered execution

LINQ to XML Combining it with other LINQ technologies makes life easierCombining it with other LINQ technologies makes life easier XElement xml = new XElement("contacts", new XElement("contact", new new XAttribute("contactId", "2"), new XElement("firstName", "Barry"), new XElement("lastName", "Gottshall") ), new XElement("contact", new XAttribute("contactId", "2"), new XElement("firstName", "Barry"), new XElement("lastName", "Gottshall") ), new XElement("contact",new new XAttribute("contactId", "3"), new XAttribute("contactId", "3"),new new XElement("firstName", "Armando"), new XElement("lastName", "Valdes") ) ); new XElement("firstName", "Armando"), new XElement("lastName", "Valdes") ) );new

LINQ to XML Result from previous example:Result from previous example: <contacts> Barry Gottshall Barry Gottshall </contact> Armando Valdes Armando Valdes </contact></contacts>

LINQ to DataSet(s) Allows developers to query existing DataSet sources within applicationsAllows developers to query existing DataSet sources within applications Offline, still uses IQueryable approachOffline, still uses IQueryable approach 2 types of queries, depending on use of typed/un- typed datasets2 types of queries, depending on use of typed/un- typed datasets Use LINQ in current applications without re-writing using LINQ to SQLUse LINQ in current applications without re-writing using LINQ to SQL Bi-directional: LINQ Sequence -> DataTable -> LINQ Sequence supportBi-directional: LINQ Sequence -> DataTable -> LINQ Sequence support Allows developers to query existing DataSet sources within applicationsAllows developers to query existing DataSet sources within applications Offline, still uses IQueryable approachOffline, still uses IQueryable approach 2 types of queries, depending on use of typed/un- typed datasets2 types of queries, depending on use of typed/un- typed datasets Use LINQ in current applications without re-writing using LINQ to SQLUse LINQ in current applications without re-writing using LINQ to SQL Bi-directional: LINQ Sequence -> DataTable -> LINQ Sequence supportBi-directional: LINQ Sequence -> DataTable -> LINQ Sequence support

How Does it Work? Depends on if the type is {0} or notDepends on if the type is {0} or not IQueryable IQueryable System.Linq.Queryable (System.Data.Linq.DataQuery )System.Linq.Queryable (System.Data.Linq.DataQuery ) SQLSQL EntityEntity DatasetsDatasets The extension methods build an expression treeThe extension methods build an expression tree If not, then check if it is a IEnumerable If not, then check if it is a IEnumerable System.Linq.IEnumerable System.Linq.IEnumerable ObjectsObjects XMLXML The extension methods run the queryThe extension methods run the query Depends on if the type is {0} or notDepends on if the type is {0} or not IQueryable IQueryable System.Linq.Queryable (System.Data.Linq.DataQuery )System.Linq.Queryable (System.Data.Linq.DataQuery ) SQLSQL EntityEntity DatasetsDatasets The extension methods build an expression treeThe extension methods build an expression tree If not, then check if it is a IEnumerable If not, then check if it is a IEnumerable System.Linq.IEnumerable System.Linq.IEnumerable ObjectsObjects XMLXML The extension methods run the queryThe extension methods run the query

How Does it Work? Objects <book> </book> XML.NET Language Integrated Query C# 3.0 VB 9.0 Others… Relational LINQ to Objects LINQ to SQL LINQ to XML LINQ to Entities LINQ to Datasets

How Does it Work? Extension methods for the from/select/where/groupby keywordsExtension methods for the from/select/where/groupby keywords Lambda expressionsLambda expressions Expression tree for building & pre-compiling the statement that will run on a IQueryable Expression tree for building & pre-compiling the statement that will run on a IQueryable p=> p.CompanyName.StartsWith(“A”)p=> p.CompanyName.StartsWith(“A”) Iterators for the in-memory queries (IEnumerable )Iterators for the in-memory queries (IEnumerable ) foreach on an IEnumerable foreach on an IEnumerable Extension methods for the from/select/where/groupby keywordsExtension methods for the from/select/where/groupby keywords Lambda expressionsLambda expressions Expression tree for building & pre-compiling the statement that will run on a IQueryable Expression tree for building & pre-compiling the statement that will run on a IQueryable p=> p.CompanyName.StartsWith(“A”)p=> p.CompanyName.StartsWith(“A”) Iterators for the in-memory queries (IEnumerable )Iterators for the in-memory queries (IEnumerable ) foreach on an IEnumerable foreach on an IEnumerable

What’s Next? PLINQPLINQ Parallel FX LibraryParallel FX Library IParallelEnumerable IParallelEnumerable CTP is availableCTP is available Support for 3 rd party DB enginesSupport for 3 rd party DB engines PLINQPLINQ Parallel FX LibraryParallel FX Library IParallelEnumerable IParallelEnumerable CTP is availableCTP is available Support for 3 rd party DB enginesSupport for 3 rd party DB engines