Language Integrated Query (LINQ)

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.
Object Relational Mapping A to Z. About Me Over A Decade of I.T. Experience Web Developer, DBA, DevOps, Mobile Microsoft Cert. in SQL Server Twitter:
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
Damien Guard (BSc, MBCS) Guernsey Software Developer Forum Language Integrated Query:
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
Graeme Scott – Technology Solution Professional Reduce Infrastructure Costs & Increase Productivity with SQL Server 2008.
If you have SQL Server 2005, you get all the features below plus the following: If you have SQL Server 2000, you get all the features below plus.
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.
SQL Server ® 2008 ® Native Client. Agenda  Introduction to SQL Server Native Client  Building High-Performance Data Access Solutions  Going Beyond.
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.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
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.
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.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
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.
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
Luke Hoban Senior Program Manager Microsoft Session Code: DTL319.
2 Behind every great site, there is great data Eric Nelson Developer Evangelist Microsoft UK
Data Access Methodologies: When to choose what (ADO.NET, Entity Framework, WCF Data Services) Wriju Ghosh Lead Partner Consultant, Microsoft.
SQL Server 2005:.NET Framework Programming in the Database Tim Sneath Architectural Engineer, Microsoft
Comprehensive Flexible Global Storage and Search Responsive Available Secure Manageable Federation Coordination Consolidation Transformation Synchronization.
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Language Integrated Query: (LINQ) An introduction
Avalon – Using Data In Your Applications
Visual Studio Tools for Office 2005
Optimizing Microsoft SQL Server 2008 Applications Using Table Valued Parameters, XML, and MERGE
ADO.NET Entity Framework
ADO.NEXT Advances in Data Access for 2008
An Introduction to Entity Framework
Microsoft SQL Server 2008 Reporting Services
Microsoft Connect /24/ :05 AM
Entity Framework Core.
SharePoint data access and LINQ to SharePoint
Microsoft Connect /1/2018 2:36 AM
Advances for Data in VS “Orcas”
Microsoft Connect /17/2019 9:04 AM
Advances for Data in VS “Orcas”
Developing and testing enterprise Java applications
Технологии доступа к данным на платформе Microsoft.NET
ADO.NET Entity Framework
7/19/2019 2:53 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Visual Studio 2008.
Mark Quirk Head of Technology Developer & Platform Group
Visual Studio 2005 IDE Features
Presentation transcript:

Language Integrated Query (LINQ) 12/7/2018 2:54 AM Language Integrated Query (LINQ) © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

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 >= @date GROUP BY o.OrderID HAVING Total >= 1000"; cmd.Parameters.AddWithValue("@date", 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); } Query syntax is native application code Data objects are first-class citizens

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

No new syntaxes 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;

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

Flexibility LINQ to SQL LINQ to Entities LINQ to DataSet LINQ to XML 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 <xml> … </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

LINQ to XML Using LINQ with XML XML API of choice in .NET Framework 3.5 Simpler and more efficient than System.Xml LINQ to XML 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(); <xml> … </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<string>("LastName") == "Smith" select r.Field<string>(“FirstName”);

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

© 2004 Microsoft Corporation. All rights reserved. 12/7/2018 2:54 AM This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.