Language Integrated Query (LINQ). Data Access Programming Challenges Developers must learn data store-specific query syntax Multiple, disparate data stores.

Slides:



Advertisements
Similar presentations
Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
Advertisements

Programming with ADO.NET By Sam Nasr April 27, 2004 Programming with ADO.NET By Sam Nasr April 27, 2004.
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
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
.NET Database Technologies: Open-Source Frameworks.
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.
ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
1 Agenda Data and System Trends ChallengesObservationsConclusion.
Building a Complete Web Application Using ASP.NET 3.5 & Visual Studio 2008 (Part 1 of 2) Jeff King Program Manager Microsoft Corporation
Visual Studio 2008 and ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
Design & Development Tools: Visual Studio 2005 SQL Server 2005 Biztalk Server 2006 David Gristwood, Mike Taulty Developer & Platform Group Microsoft Ltd.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
Jeremy Boyd Director – Mindscape MSDN Regional Director
Graeme Scott – Technology Solution Professional Reduce Infrastructure Costs & Increase Productivity with SQL Server 2008.
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.
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
Powerful, modern desktops enable next generation applications Hardware acceleration brings real-time lighting, texturing and rendering Visual.
SQL Server Developer Tools, Codename “Juneau” Database Services Sanjay Nagamangalam Principal Program Manager SQL Server Manageability.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
1 Entity Framework Introduction. Outline Goals of Entity Framework 2.
Reflection IT LINQ & Entity Framework Fons Sonnemans (Trainer)
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
.NET Database Programmability and Extensibility in Microsoft SQL Server José A. Blakeley, Mat Henaire, Christian Kleinerman, Isaac Kunen, Adam Prout, Vineet.
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.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
LINQ and C# 3.0 Mads Torgersen Program Manager for the C# Language Microsoft Corporation.
DAT 379 XML Today And Tomorrow Mark Fussell Lead Program Manager Microsoft Corporation.
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.
Deep Dive into the ADO.NET Entity Framework. Agenda Entity Data Model Advanced Mapping Advanced querying Entity SQL Object Services ADO.NET Metadata.
Microsoft Sync Framework Content flow for the enterprise.
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.
EntityFrame work and LINQ CH 14. linq LINQ enables you to query data from a wide variety of data sources, directly from your programming code. LINQ is.
1.NET Language Integrated Query Yishai Zaltzberg.
SO RELIABLE Iain Bray Sales Engineer InterSystems Corporation.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
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.
Stephen Forte DAT401 from s in dat.Speaker select s.Bio; Chief Strategy Officer of Telerik Certified Scrum Master Active in the community: International.
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
Ken Casada Developer Evangelist Microsoft Switzerland
ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation.
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
2 Behind every great site, there is great data Eric Nelson Developer Evangelist Microsoft UK
SQL Server 2005:.NET Framework Programming in the Database Tim Sneath Architectural Engineer, Microsoft
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Language Integrated Query: (LINQ) An introduction
ADO.NET Entity Framework
An Introduction to Entity Framework
Language Integrated Query (LINQ)
Advances for Data in VS “Orcas”
Advances for Data in VS “Orcas”
Developing and testing enterprise Java applications
Технологии доступа к данным на платформе Microsoft.NET
ADO.NET Entity Framework
Visual Studio 2008.
Mark Quirk Head of Technology Developer & Platform Group
Presentation transcript:

Language Integrated Query (LINQ)

Data Access Programming Challenges Developers must learn data store-specific query syntax Multiple, disparate data stores Difficult to debug and maintain Code is often complex and verbose Data access code is mixed with application code Data schemas do not match application object models Data model mismatch

Introduction to LINQ Extensions for.NET languages Native syntax for query operations Strong typing and object-orientation for data Implementations for disparate data sources Language Integrated Query (LINQ)

Data Access Code Today class DataAccess{ static void GetNewOrders(DateTime date, int qty) { using (SqlConnection con = new SqlConnection(Settings.Default.NWDB)) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandText SELECT o.OrderDate, o.OrderID, SUM(d.Quantity) as Total FROM Orders AS o LEFT JOIN [Order Details] AS d ON o.OrderID = d.OrderID WHERE o.OrderDate GROUP BY o.OrderID HAVING Total >= 1000"; date); DbDataReader r = cmd.ExecuteReader(); while (r.Read()) { Console.WriteLine("{0:d}:\t{1}:\t{2}", r["OrderDate"], r["OrderID"], r["Total"]); } class DataAccess{ static void GetNewOrders(DateTime date, int qty) { using (SqlConnection con = new SqlConnection(Settings.Default.NWDB)) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandText SELECT o.OrderDate, o.OrderID, SUM(d.Quantity) as Total FROM Orders AS o LEFT JOIN [Order Details] AS d ON o.OrderID = d.OrderID WHERE o.OrderDate GROUP BY o.OrderID HAVING Total >= 1000"; date); DbDataReader r = cmd.ExecuteReader(); while (r.Read()) { Console.WriteLine("{0:d}:\t{1}:\t{2}", r["OrderDate"], r["OrderID"], r["Total"]); } Query syntax is source- specific and must be embedded into application code Data values are contained in a data structures, which must be navigated

Data Access Code with LINQ class DataAccess { static void GetNewOrders(DateTime date, int qty) { using (NorthWindDB nw = new NorthWindDB ()) { var orders = from o in nw.Orders where o.OrderDate > date select new { o.orderID, o.OrderDate, Total = o.OrderLines.Sum(l => l.Quantity); foreach (SalesOrder o in orders) { Console.WriteLine("{0:d}\t{1}\t{2}", o.OrderDate, o.OrderId, o.Total); } class DataAccess { static void GetNewOrders(DateTime date, int qty) { using (NorthWindDB nw = new NorthWindDB ()) { var orders = from o in nw.Orders where o.OrderDate > date select new { o.orderID, o.OrderDate, Total = o.OrderLines.Sum(l => l.Quantity); foreach (SalesOrder o in orders) { Console.WriteLine("{0:d}\t{1}\t{2}", o.OrderDate, o.OrderId, o.Total); } Query syntax is native application code Data objects are first-class citizens

Benefits of LINQ LINQ Simpler data access code Increased developer productivity Flexible data access for the enterprise

Simplicity Instead of having to learn and work in multiple languages (e.g., C#, T-SQL, XSLT) you now work in one language – yours! No new syntaxes var customers = from c in db.Customers where c.City == "London" select c; var customers = from c in db.Customers where c.City == "London" select c;

Productivity Faster, more reliable application development Compile- time error checking Intellisense Native CLR types

Flexibility Strongly-typed LINQ access to DataSet functionality Strongly-typed LINQ access to XML data Strongly-typed LINQ access to Microsoft ADO.NET Entity Framework Strongly-typed LINQ access to SQL Server LINQ to SQL LINQ to Entities LINQ to DataSet LINQ to XML

Using LINQ with Relational Data Rapid development against SQL Server® Ideal for direct 1:1 mapping to database schema Minimally intrusive object model LINQ to SQL Strongly-typed data access to relational data sources through Entity Framework Flexible mapping to relational schema Enterprise-level data modeling LINQ to Entities

var d = XDocument.Load(xmlPath) var categories = from c in d.Descendants( "category") select new { Name = (string)c.Attribute("name"), Value = (string)c.Attribute("id") }; CategoryList.DataSource = categories; CategoryList.DataBind(); var d = XDocument.Load(xmlPath) var categories = from c in d.Descendants( "category") select new { Name = (string)c.Attribute("name"), Value = (string)c.Attribute("id") }; CategoryList.DataSource = categories; CategoryList.DataBind(); Using LINQ with XML XML API of choice in.NET Framework 3.5 Simpler and more efficient than System.Xml LINQ to XML

Using LINQ with DataSets Query DataSets with consistent LINQ syntax Greater power and simpler code than existing Select, RowFilter and Find methods LINQ to DataSet var query = from r in customerDataTable.AsEnumerable() where r.Field ("LastName") == "Smith" select r.Field (“FirstName”); var query = from r in customerDataTable.AsEnumerable() where r.Field ("LastName") == "Smith" select r.Field (“FirstName”);

Summary Simplify data access code Enhance developer productivity Create flexible data access solutions Use LINQ to

This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.