Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com http://www.mtaulty.com
Barriers Between Code & Data Relational XML "The Data Barrier" My Code Object Objects Metadata Type Safety Compile time checking IntelliSense
Today - "String in", "Object Out" Relational XML We get back an opaque data type XmlNode DataTable, DataReader Metadata Type Safety Compile time checking IntelliSense We solve the problem with a string... "/descendant-or-self/..." "SELECT * FROM ..." "The Data Barrier" My Code
These errors show up at runtime, not compile time Today - Illustrated These errors show up at runtime, not compile time
Tomorrow - Query in the Languages The Language Integrated Query Pattern from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr (into itemName)? let itemName = selExpr where predExpr orderby (keyExpr (ascending | descending)?)* select selExpr group selExpr by keyExpr into itemName query-body Relational XML Object Objects
Taking LINQ to Common Data Stores Objects XML SQL DataSet 1 2 3
LINQ over XML 1 LINQ Pattern New XML API from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr (into itemName)? let itemName = selExpr where predExpr orderby (keyExpr (ascending | descending)?)* select selExpr group selExpr by keyExpr into itemName query-body New XML API
System.Xml.Linq New XML API (more DOM than reader) Key classes: XElement, XAttribute
LINQ over XML
Object Relational Mapping API LINQ to SQL 2 LINQ Pattern from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr (into itemName)? let itemName = selExpr where predExpr orderby (keyExpr (ascending | descending)?)* select selExpr group selExpr by keyExpr into itemName query-body Object Relational Mapping API Code Gen Tools
System.Data.Linq – Data API
LINQ to SQL
LINQ to DataSet 3 LINQ Pattern DataSet/DataTable FirstName LastName from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr (into itemName)? let itemName = selExpr where predExpr orderby (keyExpr (ascending | descending)?)* select selExpr group selExpr by keyExpr into itemName query-body FirstName LastName Age Height Fred Smith 55 1.2 Jim Jones 22 1.3 John Doe 43 1.4 Jo Blogs 17 1.5 DataSet/DataTable
Linq to DataSet Existing DataTable already has some query capabilities LINQ syntax extends to DataSet to apply the same model for querying
LINQ to DataSet
Summary Powerful, intuitive LINQ pattern For Relational Data One "syntax" to learn Relational, hierarchical, object data Underpinned by new or existing API's For Relational Data LINQ to SQL ORM over database schema LINQ to DataSet
roadshowresources.com