LINQ: It’s Not Your Father’s Data Access Denny Boynton Anheuser-Busch Companies.

Slides:



Advertisements
Similar presentations
The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Advertisements

Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
© Logica All rights reserved ADO vNext LINQ LINQ to SQL Entity Framework Freek Leemhuis
DEV306 LINQ (Language Integrated Query)
Joshua Clark Consultant Sogeti USA Blog:
Live from Redmond: WebCast Conquering XML with Visual Basic 9 Amanda Silver Lead Program Manager Visual Basic Level: Starts Easy, Finishes Advanced.
Overview of Next-gen technologies Raimond Brookman IT Architect Info Support
1 Visual Studio 2008 Fons Sonnemans (Trainer) Reflection IT
ASP.NET 3.5 New Features. 2 Agenda What's New in.NET Framework 3.5? Visual Studio 2008 Enhancements LINQ (Language Integrated Query) New ASP.NET Server.
C# 3.0 & LINQ Raimond Brookman – IT Architect
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
1 Agenda Data and System Trends ChallengesObservationsConclusion.
LINQ: Language-Integrated Queries (To be included in C # 3.0) Technology developed by Anders Hejlsberg & friends at Microsoft (2005) Presented by Tal Cohen.
Building a Complete Web Application Using ASP.NET 3.5 & Visual Studio 2008 (Part 1 of 2) Jeff King Program Manager Microsoft Corporation
C# 3.0 Tom Roeder CS fa. Version 3 From PDC 2005 preview compiler available LINQ: language-integrated query High level points: adds native query.
Visual Studio 2008 and ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
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.
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Beth Massi Program Manager Visual Studio Community.
Paul Yuknewicz Lead Program Manager Microsoft Visual Basic DEV 319.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Slides from Gang Luo, Xuting Zhao and Damien Guard
Reflection IT LINQ & Entity Framework Fons Sonnemans (Trainer)
LINQ, An IntroLINQ, An Intro Florin−Tudor Cristea, Microsoft Student Partner.
Eric Vogel Software Developer A.J. Boggs & Company.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics LINQ to XML: A Brief Overview Pavel Ježek.
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Intro to C#.net and EF Ilan Shimshoni. The Three Faces of ADO.NET The connected layer – Directly connecting to the DB The disconnected layer – Using datasets.
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
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.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
LINQ and C# 3.0 Mads Torgersen Program Manager for the C# Language Microsoft Corporation.
The.NET Language Integrated Query Project Anders Hejlsberg TLN306 Technical Fellow Microsoft Corporation.
1 TPlite is Back! Jim Gray Microsoft Research High Performance Transaction Processing Workshop, Asilomar, CA.,
 Language Integrated Query  Make query a part of the language  Component of.NET Framework 3.5  Shipped with Visual Studio 2008.
LINQ Providers Or why.NET rules, and Java doesn’t Branimir Giurov SofiaDev.org UG Lead, C# MVP Freelance Software Developer
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Välkommen till Sommarkollo VISUAL STUDIO 2008.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
AUC Technologies LINQ (Language Integrated Query) LINQ Presented By : SHAIKH SHARYAR JAVED Software Engineer (Daedalus Software Inc.) Technology Teacher.
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.
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
Linq Overview Vincent GERMAIN. Evolution - Rappel Langage  C# 2.0  C# 3.0 (Local type inference, Lambda expression, Method extension,Anonymous type)
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
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
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
Jon JahrenJon Jahren Produktsjef, Microsoft NorgeProduktsjef, Microsoft Norge
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
XML: Extensible Markup Language
Introduction to Entity Framework
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2016
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2013
Intro to LINQ Part 2 – Concepts and LINQ to Objects
Language Integrated Query: (LINQ) An introduction
ADO.NET Entity Framework
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
An Introduction to Entity Framework
Language Integrated Query (LINQ)
Visual Studio “Orcas” & .NET Framework v3.5
Language Integrated Query (LINQ)
04 | Data Acess Technologies
Presentation transcript:

LINQ: It’s Not Your Father’s Data Access Denny Boynton Anheuser-Busch Companies

Goals –Provide overview of the LINQ project –Demonstrate basic functionality of LINQ –Point out learning resources for self study

What is LINQ? “Language Integrated Query” Evolution of application data management Coming with C# 3.0 and VB.NET 9.0 Anders Hejlsberg Don Box

The Problem –Worlds of OO and data access are far, far apart –OO language types and native database types are often different –SQL code is “inside the quotes” No strong typing or compile-time type checking No Intellisense No Statement completion –SQL and XML have query languages, objects to not LINQ seeks to bridge the gap

What is LINQ? Standard Query Operators Objects DLinq (ADO.NET) XLinq(System.Xml) XML.NET Language Integrated Query C#VBOthers… SQLWinFS Source: Anders Hejlsberg’s PDC Presentation

Examine the basics of LINQ Demo

Language Enhancements Lambda Expressions Extension Methods Local Variable Type Inference Object Initializers Anonymous Types Query Expressions C => c.Name c.Customers.Where(…).Select(…) var n = 5; new Point {x=1, y=2} New {c.Name, c.Phone}from..where…select

Standard Query Operators RestrictionWhere ProjectionSelect, SelectMany OrderingOrderBy, ThenBy GroupingGroupBy QuantifiersAny, All PartitioningTake, Skip, TakeWhile, SkipWhile SetsDistinct, Union, Intersect, Except ElementsFirst, FirstOrDefault, ElementAt AggregationCount, Sum, Min, Max, Average ConversionToArray, ToList, ToDictionary CastingOfType Source: Anders Hejlsberg’s PDC Presentation

DLinq A means of managing relational data SqlConnection c = new SqlConnection(…); c.Open(); SqlCommand cmd = new c.Name, c.Name, c.Phone FROM Customers c FROM Customers c WHERE c.City WHERE c.City "London“); DataReader dr = c.Execute(cmd); while (dr.Read()) { string name = dr.GetString(0); string name = dr.GetString(0); string phone = dr.GetString(1); string phone = dr.GetString(1); DateTime date = dr.GetDateTime(2); DateTime date = dr.GetDateTime(2);}dr.Close(); Accessing data today: Queries in quotes Loosely bound arguments Loosely typed result sets No compile time checks

DLinq public class Customer { … } public class Northwind: DataContext { public Table Customers; public Table Customers; …} Northwind db = new Northwind(…); var contacts = from c in db.Customers from c in db.Customers where c.City == "London" where c.City == "London" select new { c.Name, c.Phone }; select new { c.Name, c.Phone }; Accessing data with DLinq Classes describe data Strongly typed connection Integrated query syntax Strongly typed results Tables are like collections

DLinq Language integrated data access –Maps tables and rows to classes and objects –Builds on ADO.NET and.NET Transactions Mapping –Encoded in attributes –Relationships map to properties Persistence –Automatic change tracking –Updates through SQL or stored procedures

XLinq XmlDocument doc = new XmlDocument(); XmlElement contacts = doc.CreateElement("contacts"); foreach (Customer c in customers) if (c.Country == "USA") { if (c.Country == "USA") { XmlElement e = doc.CreateElement("contact"); XmlElement e = doc.CreateElement("contact"); XmlElement name = doc.CreateElement("name"); XmlElement name = doc.CreateElement("name"); name.InnerText = c.CompanyName; name.InnerText = c.CompanyName; e.AppendChild(name); e.AppendChild(name); XmlElement phone = doc.CreateElement("phone"); XmlElement phone = doc.CreateElement("phone"); phone.InnerText = c.Phone; phone.InnerText = c.Phone; e.AppendChild(phone); e.AppendChild(phone); contacts.AppendChild(e); contacts.AppendChild(e); }doc.AppendChild(contacts); Programming XML today <contacts> Great Lakes Food Great Lakes Food (503) (503) …</contacts> Imperative model Document centric No integrated queries Memory intensive

XLinq XElement contacts = new XElement("contacts", from c in customers from c in customers where c.Country == "USA" where c.Country == "USA" select new XElement("contact", select new XElement("contact", new XElement("name", c.CompanyName), new XElement("name", c.CompanyName), new XElement("phone", c.Phone) new XElement("phone", c.Phone) )); Programming XML with XLinq Declarative model Element centric Integrated queries Smaller and faster

XLinq Language integrated query for XML –Expressive power of XPath / XQuery –But with C# or VB as programming language Leverages experience with DOM –Element centric, not document centric –Functional construction –Text nodes are just strings –Simplified XML namespace support –Faster and smaller

Show DLinq and XLinq in action Demo

What is LINQ? The LINQ project is: –Language Integrated Query for.NET Native query syntax for.NET languages –Standard Query Operators SQL-like method extensions for any.NET collection System.Query namespace –DLinq Code name for future version of ADO.NET Query enabled data access framework System.Data.Xlinq namespace –XLinq Query enabled, smaller, faster XML DOM System.XML.Xlinq namespace

Benefits of LINQ Unified querying of objects, relational, XML Type checking and IntelliSense for queries SQL and XQuery-like power in C# and VB Extensibility model for languages / APIs

Closing Thoughts Not sure where use of LINQ will coincide with SQL Use may well be driven by data management standards of an organization –Where should data access really “live” ORM synchronization This could really be a revolution

Resources LINQ Project Home Page – Anders Hejlsberg – LINQ – 80http://channel9.msdn.com/showpost.aspx?postid= LINQ Project Overview Whitepaper – ull=/library/en-us/dndotnet/html/linqprojectovw.asp

Thank You Denny Boynton